phpfacebookfacebook-graph-api

Unable to retrieve "me" profile information in Facebook via PHP


I am trying to get some profile information in my Facebook via PHP as specified in,

http://developers.facebook.com/docs/authentication/

$user = json_decode(file_get_contents(
'https://graph.facebook.com/me?access_token=' .
$cookie['access_token']))->me;

When I run this code, I am getting the following warning:

Warning: file_get_contents(.....) [function.file-get-contents]: failed to open stream: No such file or directory in /home/website/public_html/helloworldpp/index.php on line 30

I have truncated and add "....." instead of the actual URL. However, when I access the "....." url via the browser I am getting the json response. I am not sure why I am unable to get it via the php code. Could some one please help me out?

Thanks a bunch.


Solution

  • It's possible that opening websites with file open is disabled on your webserver. You might want to consider using Curl instead.