开发者

facebook php sdk notifications

previously it was poss开发者_如何学Pythonible to send notifications from my app to user using method:

$facebook->api_client->notifications_send

But now it is depreciated, any ideas how i can send notifications using new SDK?


Take a look at requests: http://developers.facebook.com/docs/channels/#requests

Using the Graph API you can make a request with:

https://graph.facebook.com/USER_ID/apprequests?message='INSERT_UT8_STRING_MSG'&data='INSERT_STRING_DATA'&access_token=VALID_ACCESS_TOKEN&method=post

Example from above link:

<?php 

  $app_id = YOUR_APP_ID;
  $app_secret = YOUR_APP_SECRET;

  $token_url = "https://graph.facebook.com/oauth/access_token?" .
    "client_id=" . $app_id .
    "&client_secret=" . $app_secret .
    "&grant_type=client_credentials";

  $app_access_token = file_get_contents($token_url);

  $user_id = THE_CURRENT_USER_ID;

  $apprequest_url ="https://graph.facebook.com/" .
    $user_id .
    "/apprequests?message='INSERT_UT8_STRING_MSG'" . 
    "&data='INSERT_STRING_DATA'&"  .   
    $app_access_token . "&method=post";

  $result = file_get_contents($apprequest_url);
  echo("App Request sent?", $result);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜