0

I am trying to retrieve facebook uesr ID via graph from below code

$post =  "https://graph.facebook.com/me?access_token=".$access_token;
$response = file_get_contents($post);

I get the following error:

Warning: /me cannot be read [file_get_contents] https://graph.facebook.com/me?access_token=AAIvGrJsBAI3nLAbfaqyh8NExN5e21yKCvJAjVOGJ9ira1RdCDHRFszktHnDCY44urQtxdBHMKEsX1K7QAUWXSYF5ip3l68JI8xKeopjYdssds

But when i try to access the above graph URL via browser, its working correctly. So my access token is valid.

Note: I am using google app engine so I can't use cURL.

Daniil Ryzhkov
  • 7,416
  • 2
  • 41
  • 58
Vishnu Chid
  • 1,463
  • 2
  • 10
  • 10

2 Answers2

1

Use cURL or this class: http://ideone.com/Q1Zfl

I've used this class many times and it behaves well.

Usage:

$url = '...';
$req = new Request($url);
$data = $req->DownloadToString();

P.S I hope the link does not expire

0

You can use

$content = @file_get_contents($site);

To hide the error. If it's dont work. You go to the ini.php file and find the line

Allow_url_fopen = Off

Change "off" to "on"

Allow_url_fopen = On