Access public pictures without an access token?

喜你入骨 提交于 2019-12-11 20:39:54

问题


I created a php module for Drupal that pulls a public album and display pictures inside it. I discovered that the module suddenly stopped working. I googled and looks like even a public album requires an access token now. I see access token field on https://developers.facebook.com/tools/explorer/?method=GET&path=10150146071791729

In this case, how do I fix this problem? It looks like even offline_access is gone now.

Do I must ask users to accept a certain permission? What permission? It's a public pictures.


回答1:


Ok, found an answer.

You need to create an app and get an app id and a secret key.

Once you have those two, download Facebook PHP SDK on https://github.com/facebook/facebook-php-sdk.

Sample Code:

require_once "facebook.php";

$facebook = new Facebook(array(
  'appId'  => 'appid',
  'secret' => 'securet',
));

$token = $facebook->getAccessToken();

$json = file_get_contents("https://graph.facebook.com/293849234?access_token=".$token);


来源:https://stackoverflow.com/questions/16406501/access-public-pictures-without-an-access-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!