我的代码不工作,上传做得好,但标注失败:(
它显示致命错误:未捕获OAuthException:(#121)无效的带照片的身份证丢照片标记问题 - 的Facebook /图形API
$facebook->setFileUploadSupport(true);
$album_details = array(
'message'=> 'Description',
'name'=> 'Name'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
$photo_details = array(
'message'=> 'Photo Description',
'tags'=> makeTagArray($friendsID),
);
$photo_details['image'] = '@' . realpath('img/'.$img_name);
// $upload_photo = $facebook->api('/'.$create_album['id'].'/photos', 'post', $photo_details);
$upload_photo = $facebook->api('/'.$create_album['id'].'/photos?access_token='.$facebook->getAccessToken(),'post', $photo_details);
function makeTagArray($userId) {
foreach($userId as $id) {
$tags[] = array('tag_uid'=>$id, 'x'=>$x,'y'=>$y);
$x+=50;
$y+=50;
}
$tags = json_encode($tags);
return $tags;
}
其他必要的信息
'req_perms' => 'publish_stream,status_update,user_photos'
我也试过,但没有工作,就说明数据[]
$x=5;
$response='';
for ($i=0;$i<count($friendsName);$i++)
{
$post_url = "https://graph.facebook.com/".$upload_photo['id']."/tags/".$friendsID[$i]."?access_token=".$facebook->getAccessToken()."&x=".$x."&y=80&method=POST";
$response = $response.file_get_contents($post_url);
$x = $x + 53;
}
Examle $ POST_URL对一个人的话,我这运行在一个循环中的所有人员
https://graph.facebook.com/Pic_ID/tags/620949133?access_token=Access_Token|2.AQDOMdHNge0UCXG6.3600.1307613600.1-100001916529381|lCYzRYy9YPJvy1WBqkuoGVWvd50&x=5&y=80&method=POST
显示
{
"error" : {
"type": "OAuthException",
"message": "An access token is required to request this resource."
} }
我也有些变了值有意
该问题与代码无关,GRAPH API出现问题,现在它已解决:) – Sourav 2011-06-10 14:04:14