PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 13, 2022

[FIXED] How to post on Facebook all friends wall?

 March 13, 2022     facebook, facebook-graph-api, facebook-php-sdk     No comments   

Issue

I have an app which is able to

  1. Post on a user's wall

  2. Publish_stram and read_friendlists permissions

  3. Able 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
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing