1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Convert Facebook uid into Facebook username!

Discussion in 'Freebies / Giveaways' started by sexaku, Aug 16, 2014.

  1. sexaku

    sexaku Newbie

    Joined:
    Jan 5, 2014
    Messages:
    2
    Likes Received:
    0
    Hi guys,
    I've been lurking here for some time now, time to share something with the community.
    Note: you may increase maximum execution time on your webserver if you wanna convert long lists.
    Have fun guys!
    UPDATE: sorry, i cant post the code here for gods sake, the php code triggered some moderation system, im uploading it to pastebin rn.
    pastebin id: gAGndbzs
     
    Last edited: Aug 16, 2014
  2. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,066
    Likes Received:
    2,872
    Gender:
    Male
    Hmm post pastebin then. It's not the right forum though. Try programming section.

    OP's snippet on Pastebin:
    All credits to him :)
    Code:
    <?php
    $lines=array();
    $fp=fopen('file.txt', 'r');
    while (!feof($fp))
    {
        $line=fgets($fp);
        $line=trim($line);
        $lines[]=$line;
    
     
    }
    fclose($fp);
     
    $n = 0;
    while ($n < count($lines)){
        $response = file_get_contents('http: slash slash graph dot facebook dot com/'.$lines[$n]);
        $array = json_decode($response, true);
     
        
     
        $file = 'address.txt';
        // Open the file to get existing content
        $current = file_get_contents($file);
        // Append a new person to the file
        if (empty($array['username'])) {
           $current .= $array['id']." AT facebook dot com"."\r\n";;
        }
        else {
           $current .= $array['username']." AT facebook dot com"."\r\n";
        }
        
        // Write the contents back to the file
        file_put_contents($file, $current);
        $n = $n + 1;
        }
    ?>
    
     
    Last edited: Aug 16, 2014