Using PHP 5.2.11 and the new facebook graph code...
If I call
$facebook->api(\"/me\");
I get a proper response:
array
\'id\' =>
There is an even simpler way, using the provided facebook api, just call:
$facebook->api("/me?fields=picture");
This will make your code simpler and more elegant.
While using $facebook->api("/me?fields=picture"); does work, you won't be able to pass parameters such as width or type. Instead try the following:
$facebook->api('/me/picture?redirect=false');
This worked for me and will also allow you to pass parameters.
You may not even need to do an API call... use this on your frontend:
<img src="//graph.facebook.com/USER_ID/picture?type=square" />
Read more here: http://developers.facebook.com/docs/reference/api/#pictures
As an addition to betaman's answer, you can pass the parameters in a separate array like so:
$aResponse = $oFacebook->api('/me', array(
'fields' => 'picture',
'type' => 'large'
));
I just went to my "/me/picture" in the browser and it redirected me to a static image on one of Facebook's CDN servers. Perhaps the redirect is throwing a wrench in your api call.
Well I guess the best answer I've found is to call http://graph.facebook.com/USER_ID?fields=picture to get the picture URL. Its to bad they don't document things like this on their API especially when its obvious this is broken for so many people.