Graph API新的feed post对象 - 附件未显示 [英] Graph API new feed post object-Attachment not showing
问题描述
我在图形API中遇到一个奇怪的问题,下面的代码用于为我添加一条贴子给用户的新闻Feed(附有照片的缩略图)(在object_attachement参数中引用))。 >
但是现在,该帖子是按预期创建的,但缩略图为空。我正在使用的photo_id存在于用户的照片集中。
$ photo_ID =3415678920211; //有效的Facebook照片ID ...
$ facebook = new Facebook($ config) ;
$ attachment = array(
'access_token'=> $ user_token,
'message'=>测试消息,
'caption'=> ;这是一个标题,
'name'=>测试名称,
'description'=>这是一个描述,
'link'=> 'http://url.com/',
'object_attachment'=> $ photo_id,
);
$ response = $ facebook-> api(/\".$ userID/ feed /,'POST',$ attachment);
我做错了吗?我确信这是有用的,并且想知道在我下面的API中是否有变化。
[更新]
我注意到,这似乎发生在我指定链接和object_attachment在同一个POST中。如果我从上面删除链接参数,那么我得到一个稍微更好的更新,但这不是很好,因为我想要这个帖子存在的主要原因是添加链接。
我假设用户授予user_photos / friends_photos的权限。因为你有photo_id,你可以尝试这个。
$ pic = $ facebook-> api(/ PHOTO_ID) ;
$ pic_url = $ pic-> source;
$ attachment = array(
'access_token'=> USER_ACCESS_TOKEN,
'message'=>...,
'caption'=> ;...,
'name'=>...,
'description'=>...,
'link'=> URL ,
'picture'=> $ pic_url
);
ADDED
您需要将映像存储在本地的本地服务器中。由于这个文章
I'm having a strange problem with the graph API, the below code used to work for me adding a post to a users news feed with a thumbnail of the attached photo (referenced in 'object_attachement' parameter).
However now the post is created as expected however the thumbnail is empty. The photo_id I am using exists in the user's photo collection.
$photo_ID = "3415678920211";//Valid Facebook Photo ID...
$facebook = new Facebook($config);
$attachment = array(
'access_token' => $user_token,
'message' => "Test Message",
'caption' => "THis is a Caption",
'name' => "Test Name",
'description' => "This is a description",
'link' => 'http://url.com/',
'object_attachment' => $photo_id,
);
$response = $facebook->api("/".$userID."/feed/", 'POST', $attachment);
Am I doing something wrong? I am sure this did use to work and wonder if something changed in the API underneath me.
[Update] I noticed that this seems to happen when I specify both link & object_attachment in the same POST. If I remove the link param from the above then I get a slightly better update however this isn't great as the main reason I want this post to exist is for the addition of the link.
I am assuming user gave the permission for user_photos / friends_photos. Since you have the photo_id, you may try this.
$pic = $facebook->api("/PHOTO_ID");
$pic_url = $pic->source;
$attachment = array(
'access_token' => USER_ACCESS_TOKEN,
'message' => "...",
'caption' => "...",
'name' => "...",
'description' => "...",
'link' => URL,
'picture' => $pic_url
);
ADDED
You need to store the image some where locally ,in a local server . due to this article
这篇关于Graph API新的feed post对象 - 附件未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!