Issue
I have an app which is able to
Post on a user's wall
Publish_stram
andread_friendlists
permissionsAble to get a user's friends list
and get the list like
{
"name": "example1",
"id": "100003373457"
},
{
"name": "example2",
"id": "100003377"
},
How do I make a loop to post on all of a user's Facebook friends' walls with sleep()
?
Solution
Something like this will work :
foreach(friends_list as $x)
{
$ch = curl_init("https://graph.facebook.com/".$x[id]."/feed");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
"access_token"=>"..."
"message"=>"SPAM",
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
print_r($response);
sleep();
}
Answered By - Piotr Tomasik
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.