forked from BenSterenson/profileanalysis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43245d3
commit 56fb451
Showing
2 changed files
with
386 additions
and
386 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
<form method="GET"> | ||
<input type="text" name="facebook_url"/> | ||
<input type="submit" value="Extract FB ID"/> | ||
</form> | ||
|
||
<?PHP | ||
if(array_key_exists('facebook_url', $_GET) && !empty($_GET['facebook_url'])) { | ||
$profile_url = $_GET['facebook_url']; | ||
printf("Extracting User ID from : %s.<br>",$profile_url); | ||
|
||
function get_web_page( $url ) | ||
{ | ||
$user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0'; | ||
$options = array( | ||
CURLOPT_CUSTOMREQUEST =>"GET", //set request type post or get | ||
CURLOPT_POST =>false, //set to GET | ||
CURLOPT_USERAGENT => $user_agent, //set user agent | ||
CURLOPT_COOKIEFILE =>"cookie.txt", //set cookie file | ||
CURLOPT_COOKIEJAR =>"cookie.txt", //set cookie jar | ||
CURLOPT_RETURNTRANSFER => true, // return web page | ||
CURLOPT_HEADER => false, // don't return headers | ||
CURLOPT_FOLLOWLOCATION => true, // follow redirects | ||
CURLOPT_ENCODING => "", // handle all encodings | ||
CURLOPT_AUTOREFERER => true, // set referer on redirect | ||
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect | ||
CURLOPT_TIMEOUT => 120, // timeout on response | ||
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects | ||
); | ||
$ch = curl_init( $url ); | ||
curl_setopt_array( $ch, $options ); | ||
$content = curl_exec( $ch ); | ||
$err = curl_errno( $ch ); | ||
$errmsg = curl_error( $ch ); | ||
$header = curl_getinfo( $ch ); | ||
curl_close( $ch ); | ||
$header['errno'] = $err; | ||
$header['errmsg'] = $errmsg; | ||
$header['content'] = $content; | ||
return $header; | ||
} | ||
|
||
/*Getting user id */ | ||
$url = 'http://findmyfbid.com'; | ||
$data = array('url' => $profile_url ); | ||
// use key 'http' even if you send the request to https://... | ||
$options = array( | ||
'http' => array( | ||
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | ||
'method' => 'POST', | ||
'content' => http_build_query($data), | ||
), | ||
); | ||
$context = stream_context_create($options); | ||
$result = file_get_contents($url, false, $context); | ||
function getData($data) | ||
{ | ||
$dom = new DOMDocument; | ||
$dom -> loadHTML( $data ); | ||
$divs = $dom -> getElementsByTagName('code'); | ||
foreach ( $divs as $div ) | ||
{ | ||
return $div -> nodeValue; | ||
} | ||
} | ||
$uid = getData($result); // User ID | ||
printf("User ID : %s.<br>",$uid); | ||
if ($uid > 0){ | ||
$profile_pic = "http://graph.facebook.com/".$uid."/picture?width=9999"; | ||
echo "<img src=\"" . $profile_pic . "\" />"; | ||
|
||
} | ||
} | ||
else { | ||
//example: default to something if nothing has been passed | ||
echo "Enter facebook URL"; | ||
} | ||
|
||
<form method="GET"> | ||
<input type="text" name="facebook_url"/> | ||
<input type="submit" value="Extract FB ID"/> | ||
</form> | ||
|
||
<?PHP | ||
if(array_key_exists('facebook_url', $_GET) && !empty($_GET['facebook_url'])) { | ||
$profile_url = $_GET['facebook_url']; | ||
printf("Extracting User ID from : %s.<br>",$profile_url); | ||
|
||
function get_web_page( $url ) | ||
{ | ||
$user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0'; | ||
$options = array( | ||
CURLOPT_CUSTOMREQUEST =>"GET", //set request type post or get | ||
CURLOPT_POST =>false, //set to GET | ||
CURLOPT_USERAGENT => $user_agent, //set user agent | ||
CURLOPT_COOKIEFILE =>"cookie.txt", //set cookie file | ||
CURLOPT_COOKIEJAR =>"cookie.txt", //set cookie jar | ||
CURLOPT_RETURNTRANSFER => true, // return web page | ||
CURLOPT_HEADER => false, // don't return headers | ||
CURLOPT_FOLLOWLOCATION => true, // follow redirects | ||
CURLOPT_ENCODING => "", // handle all encodings | ||
CURLOPT_AUTOREFERER => true, // set referer on redirect | ||
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect | ||
CURLOPT_TIMEOUT => 120, // timeout on response | ||
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects | ||
); | ||
$ch = curl_init( $url ); | ||
curl_setopt_array( $ch, $options ); | ||
$content = curl_exec( $ch ); | ||
$err = curl_errno( $ch ); | ||
$errmsg = curl_error( $ch ); | ||
$header = curl_getinfo( $ch ); | ||
curl_close( $ch ); | ||
$header['errno'] = $err; | ||
$header['errmsg'] = $errmsg; | ||
$header['content'] = $content; | ||
return $header; | ||
} | ||
|
||
/*Getting user id */ | ||
$url = 'http://findmyfbid.com'; | ||
$data = array('url' => $profile_url ); | ||
// use key 'http' even if you send the request to https://... | ||
$options = array( | ||
'http' => array( | ||
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | ||
'method' => 'POST', | ||
'content' => http_build_query($data), | ||
), | ||
); | ||
$context = stream_context_create($options); | ||
$result = file_get_contents($url, false, $context); | ||
function getData($data) | ||
{ | ||
$dom = new DOMDocument; | ||
$dom -> loadHTML( $data ); | ||
$divs = $dom -> getElementsByTagName('code'); | ||
foreach ( $divs as $div ) | ||
{ | ||
return $div -> nodeValue; | ||
} | ||
} | ||
$uid = getData($result); // User ID | ||
printf("User ID : %s.<br>",$uid); | ||
if ($uid > 0){ | ||
$profile_pic = "http://graph.facebook.com/".$uid."/picture?width=9999"; | ||
echo "<img src=\"" . $profile_pic . "\" />"; | ||
|
||
} | ||
} | ||
else { | ||
//example: default to something if nothing has been passed | ||
echo "Enter facebook URL"; | ||
} | ||
|
||
?> |