Writing to the Facebook News feed.

I have been modifying the mock ajax example. This code is used in response.php, it takes two variables which need to be posted in through forms. This code requires facebookid and viewer_facefacebookid to be passed in from a form to look up the names and then the data is sent in from the data variable.

require_once('appinclude.php');
$name_to = $facebook->api_client->users_getInfo($_POST['facebookid'],'name, pic_small');
$name_from = $facebook->api_client->users_getInfo($_POST['viewer_facebookid'],'name, pic_small');
$title = $name_to[0][name].' was sent the following text by '.$name_from[0][name].' from the <a href=http://apps.facebook.com/mojomob>Mojo Application</a>';
$body = $_POST['data'];
$facebook->api_client->feed_publishStoryToUser($title, $body);
$facebook->api_client->feed_publishActionOfUser($title, $body);
exit;
Advertisements