how to grab facebook username? using preg_matching?
this is my sample code!
<?php
$page = file_get_contents("http://www.facebook.com/profile.php");
$username = preg_match('/<meta http-equiv=refresh content="0; URL=^[A-Za-z0-9]+$/', $page, $matches) ? $matches[1]: '/djmardagz?_fb_noscript=1';
echo $username;
?>
that’s my idea, but it’s not working, whew anyone know how to grab facebook username?
like for example:
you visit my site, after that i got your facebook username….
so how was it done? anyone know? please share 🙂
The only possible way to do that is if you get a referrer back to a url like :
Then, you can quite easily parse the url and get more information on the user. But if you do not have that information, it’s not possible to do so.
It’s quite easy to then parse the url using curl and reg matching.