English 中文(简体)
1. 创造面纱
原标题:Creating facebook apprequests

我试图在具体事件发生时向用户发送电文。 现在我有这部法律。

$param = array(
    message       =>  XYZ shared a file with you ,
    data          =>  additiona_string_data ,
    access_token  => $facebook->getAccessToken(),
);
$tmp = $facebook->api("/$uid/apprequests", "POST", $param);

但我总是收到<代码>。 Uncating OAuthException: (第2号) 未能生成任何投放的“号”申请

我不知道问题在哪里。

最佳回答

You should read the requests documentation.
In there is an explination about two different types of requests.

What you need is the app generated requests, that means you ll need the apps access token and not the users.

I assume that you are using the users access token because you did not include the initiation of the facebook object in your code sample and have probably verified the user already hence the getAccessToken() call will return the users access token and not the applications access token.

问题回答

我对“在某一具体事件发生时试图向用户发送电文时,我略感困惑。 现在我有这部法典。

  1. 当有人在隔离墙上岗时,向用户发送电子邮件

  2. 向用户发送活动邀请

  3. 向用户发送电传机

  4. 当像XYZ这样的情况发生时,在用户墙上书写,与你分享一份档案。

回答

  1. 用户的许可:<条码>。 利用实时更新监测他的隔离墙,然后利用你的服务器员工和管理当局协调会发送电子邮件。

  2. 见http://developers.facebook.com/docs/fer/api/event/#invited”rel=“nofollow”http://developers.facebook.com/docs/fer/api/event/#invited。 如何举办活动

  3. As @Lix pointed out, see https://developers.facebook.com/docs/channels/#requests

  4. 你们应当利用新的开放式图表标/行动来做到这一点。 See this example: https://developers.facebook.com/docs/beta/opengraph/tutorial/

你们可以通过下列途径获得Facebook的信号:

https://graph.facebook.com/oauth/access_token?client_id=FB_APP_ID&client_secret=FB_APP_SECRET&grant_type=client_credentials

采用Facebook PHP SDK(必要时处理更多错误):

$facebook = new Facebook(array(
   appId   => FB_APP_ID,
   secret  => FB_APP_SECRET,
));

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

$result = file_get_contents($token_url);
$splt = explode( = , $result);
$app_access_token =$splt[1];

$facebook->setAccessToken($app_access_token);

$args = array(
     message  =>  MESSAGE_TEXT ,

);
$result = $facebook->api( /USER_ID/apprequests , POST , $args);




相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签