doumao1887 2014-11-19 01:39
浏览 12

查询具有年龄限制的Facebook页面的照片

I am the administrator of a Facebook page which needs to have an age restriction of 17+ on it. On my website, I am making some Graph API queries, like querying photo albums and linking to them on Facebook. I am using the PHP Facebook API.

I can't seem to get to grips around the page access tokens and when they expire and when not. I tried to follow this answer here, which was highly voted, but it isn't clear what you do with the first access_token after you copy it. I am not sure if this is even valid any more.

I tried to access the page using the access token I get when I do me/accounts in Graph Explorer and it works, but after some time it expires and I get an exception that the token expired. I need something that stays working and doesn't expire and need me to go in and update it.

This is the code I have so far:

$fbconfig = array();
$fbconfig['appId'] = DEF_APP_ID;
$fbconfig['secret'] = DEF_APP_SECRET;
$fbconfig['fileUpload'] = false; 

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;

$facebook = new Facebook($fbconfig);

//I am not sure if the following is the right way
$facebook->setAccessToken(DEF_ACCESS_TOKEN);  
$facebook->setExtendedAccessToken();

...

try
{
    $albums_resp = $facebook->api('/'.$id.'/albums','GET'); 
    ...
}
catch (FacebookApiException $ex)
{
    error_log($ex); 
}

What is the right way to achieve this?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?