Tag friends in a Photo
This is my code. It does not show any errors but only the first 2 friends are tagged!
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;
}
I'm not receiving any error, but the code just does not tag all the people supposed to be tagged !
According to the "Publishing" section in the Facebook Developer API docs, writes to the graph must be POST'ed. Your request as written uses GET. See this question for how to convert your request to a POST.
As an aside, note that urlencode should only be applied to the parameters of a URL, not the entire URL. Otherwise the colons & slashes in the base part of your URL will get encoded as well.
精彩评论