Talking about Facebook and Php.
While I am preparing a new tutorial about Facebook applications (and a php FB game, maybe HTML5 based), I notice there isn’t any “Hello World” application about Facebook applications using the new Graph API with just some PHP lines.
If you don’t know what is the Graph API and don’t want to get an headache with strange words such as “access token”, ever mind… as said I’ll explain it in a few days. But if you are already messing with Graph API and Facebook and are looking for a really simple and working code, this is the post for you.
Try the application: Hello World.
… and get the source code:
'150635898302665','secret'=>'12345678901234567890123456789012','cookie'=>true,'domain'=>'gamemummy.com'));
$session = $facebook->getSession();
echo "Current session content:";
var_dump($session);
try{
$me = $facebook ->api('/me');
echo "Graph data about me:";
var_dump($me);
}catch(FacebookApiException $e){
echo "Facebook exception: ".$e;
$url = $facebook->getLoginUrl(array('canvas'=>1,'fbconnect'=>0));
echo "Get access token
";
}
?>
… and don’t try to steal my secret key, it’s not real…
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.