[英]Using Facebook Graph API I can access the JSOD for my album but not through an api call via PHP SDK
My problem is this. 我的问题是这个。 I can access the JSOD, for any browsers, regardless of cookies/cache using the graph API and will be granted permission. 我可以使用图形API访问任何浏览器的JSOD,无论cookie /缓存如何,都将被授予权限。 But when I try to use it with php sdk, it won't show unless I'm logged in. 但是,当我尝试将其与php sdk结合使用时,除非登录,否则它不会显示。
NOTE: 注意:
The user it's access has been oAuth'd with 'offline_access'. 已使用“ offline_access”对用户访问权限进行了授权。
This works from anywhere, anytime, regardless of me being logged in or not. 无论我是否登录,它都可以在任何地方,任何时间运行。
https://graph.facebook.com/113401955056/photos?access_token=195481353795312|21c8aad906641dc6f0894861-509590056|IEyCHjWm-3XFpX__eCtv0OMZUisectrezz
This doesn't work unless I'm already logged into Facebook. 除非我已经登录Facebook,否则此方法将无效。
<?php
require_once ('../lib/facebook.php');
$app_id = '195481353795312';
$app_secret = 'secretzz';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));
$photos = $facebook->api("/113401955056/photos?access_token=195481353795312|21c8aad906641dc6f0894861-509590056|IEyCHjWm-3XFpX__eCtv0OMZUisecretz");
foreach($photos['data'] as $photo)
{
echo '<figure class="thumbnail">
<a href="'.$photo['source'].'">
<img src="'.$photo['picture'].'" />
</a>
<figcaption class="thumb_title">'.$photo['name'].'</figcaption>
<!-- end of thumb -->
</figure><!-- end of figure -->
';
}
?>
As far as i know, you actually need the user token for off-line_access 据我所知,您实际上需要off-line_access的用户令牌
$session = $facebook->getSession();
if ($session) {
// you need to store the $session['access_token'];
}
After that, you can get the user data in an off-line manner : 之后,可以离线方式获取用户数据:
$token = array(
'access_token' => 'TOKEN HERE'
);
$userdata = $facebook->api('/me', 'GET', $token);
Here's the whole article about it - http://eagerfish.eu/using-facebook-off-line-access-to-post-on-users-wall/ I hope it helps. 这是有关它的整篇文章-http://eagerfish.eu/using-facebook-off-line-access-to-post-on-users-wall/我希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.