views:

74

answers:

1

Hi folks,

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.

Regards,
Abhi

+1  A: 

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

Billy ONeal
Hi Billy, Is there some way I can enable the file open thing in my apache web server? because, I am hosting the code in my own web space and I can make it enabled. Also, why is it disabled? Any security reasons or something?
Abhishek
@Abhishek: Unfortunately I don't know the answers to most of those questions. I just know it's turned off in favor of curl on a ton of shared hosts. My guess would be that curl is more feature rich and can be faster.
Billy ONeal
@Billy - I just checked to see file open is enabled(as in http://www.bigresource.com/Tracker/Track-php-zg2MBXjQ/) and got to know it is enabled. I still continue to have this problem :( sadly!
Abhishek
@ Billy - The CURL magic worked :) Thanks a bunch.
Abhishek