我目前正在尝试通过应用程序将照片上传到页面和组。我有这些代码:
try
{
$facebook->setFileUploadSupport(true);
$args = array('message' => 'This is my image caption',);
$args['image'] = '@'.realpath('./uploads/terragarden1.png');
$response = $facebook->api('/GROUP_ID/photos/','POST',$args);
}
catch(FacebookApiException $e)
{
echo "Error: ".$e;
}
的价值$args['image']
会是这样的:
@/home/publica/public_html/AutoPost/uploads/terragarden1.png
问题是它抛出了一个OAuthException: An unknown error has occurred.
我不太知道该如何处理这种错误。
额外的:
当我尝试使用相同的代码发布图像并进行更改时
$response = $facebook->api('/GROUP_ID/photos/','POST',$args);
into $response = $facebook->api('/me/photos/','POST',$args);
,图像将成功发布到用户的墙上。这里可能有什么问题?
这对我来说在页面上效果很好:
$attachements = array(
'access_token' => $page->getToken(),
'message' => $post_pub['title'],
'url' => 'http://site.com/images/your_image.png' );
try{
$result = $facebook->api('/'.$page->getIdFacebook().'/photos', 'POST', $attachements, function(){
});
}
catch(Exception $e){ }
可能想尝试从“图像”切换到“网址”
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)