2011-09-28 95 views
0

這是我的代碼。它不顯示任何錯誤,但只有前兩個朋友被標記!標記照片中的朋友

for ($i=0;$i<count($friendsID);$i++) 
{ 
$post_url = "https://graph.facebook.com/".$upload_photo['id']."/tags/".$friendsID[$i]."?access_token=".$token."&x=80&y=".$y."&method=POST"; 
$response = file_get_contents($post_url); 
$post_url = urlencode($post_url); 
$response = file_get_contents($post_url); 
$y = $y + 53; 
} 

我沒有收到任何錯誤,但代碼只是沒有標記所有應該被標記的人!

回答

2

根據Facebook Developer API docs中的「發佈」部分,必須對圖形寫入POST。您寫的請求使用GET。請參閱this question瞭解如何將您的請求轉換爲POST。

另外,請注意,urlencode只能應用於URL的參數,而不能應用於整個URL。否則,您的網址的底部部分中的冒號&也會被編碼。