Reputation: 21
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?
Upvotes: 1
Views: 4937
Reputation: 1009
Your accesstoken might be expired. Or invalid.
<?php
$access_token = '';
$foo = file_get_contents("https://graph.facebook.com/me?access_token=".$access_token."");
echo $foo;
?>
Upvotes: 1
Reputation: 2543
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.
Upvotes: 2