开发者

Code for cookie handling from FB documentation not working

开发者 https://www.devze.com 2023-04-02 09:27 出处:网络
there\'s a code sample in FB\'s documentation for retrieving the user\'s cookie here. It\'s the last code sample right at the bottom of that page:

there's a code sample in FB's documentation for retrieving the user's cookie here. It's the last code sample right at the bottom of that page:

The JavaScript SDK saves the details for the logged in user in a cookie named fbs_YOUR_APP_ID. The following PHP example开发者_开发百科 shows you how to use access this cookie and then customize the generated page based on this information: [...]

When I simply copy that code into a new file and fill in my app ID and my app secret, I receive the following error message:

Warning: file_get_contents(https://graph.facebook.com/me?access_token=) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in [...] at line 26

Line 26 would be the last line of the following three lines:

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

I'm a little lost right know. Any ideas?!

0

精彩评论

暂无评论...
验证码 换一张
取 消