Photos import facebook-php-sdk not working

2019-09-07 01:21发布

问题:

$facebook = new Facebook(array(

                'appId'  => '<key>',

                'secret' => '<secret code>',

                'cookie' => true

              ));

print_r($facebook);die;

Output of this is

Facebook Object
(
   [appId:protected] => <key>

   [apiSecret:protected] => <secret code>

   [session:protected] =>

   [signedRequest:protected] =>

   [sessionLoaded:protected] =>

   [cookieSupport:protected] => 1

   [baseDomain:protected] =>

   [fileUploadSupport:protected] =>
)

This problems occur in the end of October only as before that it always prints information of session. Then I call link https://api.facebook.com/method/photos.getAlbums?uid='.$session['uid'].'&access_token='.$session['access_token'] and used to get list of albums.

This works fine for more than 8 months and suddenly from last month it stopped working.

回答1:

We had some troubles on our Facebook API a couple months ago too.

Facebook has deprecated the REST API, which you are using. It is very possible the feature you're trying to access has changed and is no longer supported.

Source: http://developers.facebook.com/blog/post/616/

Switch to the new OAuth2.0 API to restore your features and future proof your application for awhile..

Here's the link to the new API documentation: http://developers.facebook.com/docs/reference/api


Oh, and in the future... Be sure to remove any API keys and secret codes from your posts. These would potentially allow someone else to use your credentials mischievously.