tags:

views:

66

answers:

1

hello file_get_contents() is returning "failed to open stream" when I call it on a Facebook access_token URL.

Warning: file_get_contents(https://graph.facebook.com/me?access_token=xxxxx) [function.file-get-contents]: failed to open stream: No such file or directory in /home/manorlog/public_html/index.php on line 109

If I try to manually hit the Facebook access_token URL it shows me my persional details

I have also tried this code and verified it works: $foo = file_get_contents('http://google.com'); echo $foo Anyone have any ideas why file_get_contents() is failing with the Facebook access_token URL?

how can i solve this issue

A: 

First thing I notice is the missing quotes around your facebook url. Also, php has the setting allow_url_fopen, which controls if you are allowed to open urls as files. But your example with Google suggests, that at least this works. Another thing I noticed: maybe you don't have SSL-support compiled into PHP? Sorry, mostly guesswork.

data
The missing quotes come from the error message. If allow_url_fopen were off, it would throw an error to that effect, and the other sites wouldn't work either... SSL is probably the best guess.
Pekka
@Pekka: As I said: allow_url_fopen can't be. But I still mentioned it in case he was somehow testing with different php-versions or settings (for example cli and apache)
data