How to post a feed item in friend's wall via Graph API

cedricdeer

New Member
I am making a very simple gift application on Facebook. The main problem here is how to notify the user which don't use the application about the fact that his friend send him a gift?As the Notifications are disabled on old REST API and \[code\]stream.publish\[/code\] will not work on the friends who didn't authorize to post on their wall, I am confused. \[code\]if (!empty($_REQUEST["ids"]) ) { $friends = ( isset($_REQUEST["ids"]) ) ? $_REQUEST["ids"] : 0; if (empty($_POST['giftname']) ) { $gname = '1.gif'; } else { $gname = $this->input->post('giftname'); } //$this->app_model->send_gift( $user, $friends, $gname,$facebook ); //$this->app_model->send_gift( $user, $friends, $gname,$facebook ); $to=$friends; $from=$user; $gift=$gname; $total_send=count($friends); for ($x=0; $x<$total_send; $x++ ) { $this->db->query("INSERT INTO gifts (`giftfrom`, `giftto`, `gname`) VALUES( $from, $to[$x], \"$gift\" )"); try { // Send notification //$facebook->api_client->notifications_send($to[$x], 'sent you a gift using <a href="http://apps.facebook.com/tsaxikner/">???????? ???????</a>. <a href="http://apps.facebook.com/tsaxikner/">?????? ?????</a>.'); // Publish feed story $feed_body = '<fb:userlink uid="'.$from.'" shownetwork="false"/>-? ???? ? ???????? <fb:name uid="'.$to[$x].'"/>-?? <a href="http://apps.facebook.com/tsaxikner/">???????? ???????</a>-? ???????.'; $feed_body = '??????? <a href="http://apps.facebook.com/tsaxikner/"> <fb:name uid="'.$to[$x].'" firstnameonly="true" possessive="true"/> ???????? ???????</a>.'; //$facebook->api_client->feed_publishActionOfUser($feed_title, $feed_body); $facebook->api_client->make_wall_post($user,$to[$x],$feed_body); $facebook->api_client->notifications_sendEmail($user, 'You have a gift', $feed_body, $fbml); //$facebook_graph->api('' $message, null, null, $target_id ); } catch(Exception $e) { echo $e->getMessage(); } } // end of for}\[/code\]I use FBML
 
Back
Top