我的代碼不工作,上傳做得好,但標註失敗:(
它顯示致命錯誤:未捕獲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