I have a blog site written in php and it posts new blog posts to twitter and a blog ping automatically under the hood using simple http post requests passed using php curl.
I have a facebook page for the blog site and want the updates to be posted to the wall on the page, is there a simple way to do this?
What I really want is a url and set of params to parcel up as an http post request.
Note that this is to post to the wall on a new style page not a profile.
Thanks in advance.
Source: Tips4all, CCNA FINAL EXAM
<?php
ReplyDelete$attachment = array(
'message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://mylink.com',
'description' => 'this is a description',
'picture' => 'http://mysite.com/pic.gif',
'actions' => array(
array(
'name' => 'Get Search',
'link' => 'http://www.google.com'
)
)
);
$result = $facebook->api('/me/feed/', 'post', $attachment);
the above code will Post the message on to your wall... and if you want to post onto your friends or others wall then replace me with the Facebook User Id of that user..for further information look out the API Documentation.
Harish has the answer here - except you need to request manage_pages permission when authenticating and then using the page-id instead of me when posting....
ReplyDelete$result = $facebook->api('page-id/feed/','post',$attachment);
You can not post to Facebook walls automatically without creating an application and using the templated feed publisher as Frank pointed out.
ReplyDeleteThe only thing you can do is use the 'share' widgets that they provide, which require user interaction.
This work to me:
ReplyDeletetry {
$statusUpdate = $facebook->api('/me/feed', 'post',
array('name'=>'My APP on Facebook','message'=> 'I am here working',
'privacy'=> array('value'=>'CUSTOM','friends'=>'SELF'),
'description'=>'testing my description',
'picture'=>'https://fbcdn-photos-a.akamaihd.net/mypicture.gif',
'caption'=>'apps.facebook.com/myapp','link'=>'http://apps.facebook.com/myapp'));
} catch (FacebookApiException $e) {
d($e);
}
If you're blog outputs an rss feed you can use Facebook's "RSS Graffiti" application to post that feed to your wall in FB. There are other RSS facebook apps as well just search facebook for rss apps...
ReplyDelete