如何通过Graph API在朋友的墙上发布Feed项

MR.*_*EWA 1 php facebook facebook-graph-api facebook-php-sdk facebook-friends

我正在Facebook上制作一个非常简单的礼物应用程序.这里的主要问题是如何通知不使用该应用程序的用户关于他的朋友送他礼物的事实?

由于在旧的REST API上禁用了通知,并且无法对stream.publish未授权在墙上发布的朋友起作用,我很困惑.

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
}
Run Code Online (Sandbox Code Playgroud)

我用的是FBML

Som*_*luk 7

我可以通过PHP API在用户的朋友墙上发布.

试试这个 :

$facebook->api('/[FRIEND_ID]/feed', 'post', array(
          'message' => 'test message',
          'link' => 'http://google.com',
          'name' => 'test name',
          'caption' => 'test caption',
          'description' => 'test long description',
      ));
Run Code Online (Sandbox Code Playgroud)