开发者

Tag friends in a Photo

开发者 https://www.devze.com 2023-04-07 22:44 出处:网络
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++)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号