user1015969
user1015969

Reputation:

facebook request dialog how to get the request_ids

Say,i've an facebook application.I use facebook request dialog javascript sdk to send invite to my friend.

At my friend account,he get;s notification and clicks the invite and he give's permission for the app .here how do i get the request id.

I'm using the code that was present in fb docs but it is giving request id only in the second invite but not at first time.

Upvotes: 2

Views: 1770

Answers (1)

David Barker
David Barker

Reputation: 14620

Request id's are delivered as a comma delimetered array.

You must use code like this to get them:

$r = $_REQUEST['request_ids'];

$rids = explode(',',$r); 

$rids will now contain an array of your request ID's.

EDIT / UPDATE:

An example of what to do on your callback:

  function sendRequestToManyRecipients() {
    FB.ui({method: 'apprequests',
      message: 'Request'
    }, requestCallback);
  }

  function requestCallback(response) {
    top.location.href="REDIRECT_URL?req="+response.request_ids;
  }

In the PHP script that it redirects to you can now request the ID's that the user has invited to your app using $_REQUEST['req']

Upvotes: 1

Related Questions