Posting a message on friend's wall, graph API. i have the publish_stream extended permission of the user, who is using the application.
the code workds if i want to post sth on my wall.
is there any method to post on wall or send message to all the friends of a particular user??
please help thanks!!
following is the code, but it is not working.
$friends = $facebook->api('/me/friends');
foreach($friends['data'] as $friend){
$friendsUserId = $friend['id'];
echo $friendsUserId . "</br>";
$result = $facebook->api('/$friendsUserId/feed', 'POST', array(
message' => 'Test Message' ));
print_r($result);
}
This would perhaps be the way to do it.. (Untested, but I use something similar for my app.)
$friends = $facebook->api('/me/friends');
foreach($friends['data'] as $friend) {
$facebook->api('/$friend['id']/feed', 'post', array(
'message' => 'just a test message',
'link' => 'http://site.com',
'name' => 'just a test name',
'caption' => 'just a test caption',
'description' => 'just a test description',
));
}
This is using the PHP API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With