List of User IDs From Requests Dialog | Migrating from fb:request-form to FB.ui apprequests | Facebook API | JavaScript | PHP
Last Updated on Wednesday, 25 May 2011 00:08 Written by Nicholas Dunbar
So the facebook requests dialog is not very well documented. It assumes you know how to do a
few things in the documentation. For instance, the "GET /ID/" listed actually means in PHP:
$result = $facebook->api('/'.$requestID.'/');
Here is the original documentation to better help you understand this article:
http://developers.facebook.com/docs/reference/dialogs/requests/
So if we are migrating from the old fb:request-form to the FB.ui requests dialog the behavior
is going to be different. Notably there will be no user IDs of the reciepients of the requests
returned in the action url. The old FBML would return a bunch of indexes of users who recieved
the request and the requests dialogue returns a list of request IDs with special data attached
to each ID. For reference the depricated FBML looked like this (scroll down):
and then I could extract all the user IDs in PHP like this:
$sentToUsersArray = array ();
if (isset ( $_REQUEST ['ids'] )) {
$sentToUsersArray = $_REQUEST ['ids'];
}
Yuck!
So now we use the FB.ui and ajax to call up the requests dialog
then the callback onInviteFriend is called and you can get the request objects by their ids which are returned in a list in the response object response.request_ids
then we send the request id list to the PHP script which requires the Facebook php api and curl installed.
pass the comma delimitate string into $sentRequestsStr and it will return a comma delimited string of the user IDs
A more elequent solution at the cost of an extra step. Ahh sigh oh well.
Here is how $result is structured so that you can get other data out of the request object.
Array (
[id] => 101501913919285
[application] => Array
(
[name] => appname
[id] => 145161830442
)
[to] => Array
(
[name] => Recieving User Name
[id] => 639139284
)
[from] => Array
(
[name] => Sent From User Name
[id] => 16037411
)
[data] => gameID=96
[message] => I thought you would dig this app!
[created_time] => 2011-05-25T04:43:26+0000
)
Set as favorite
Bookmark
Email This
Hits: 5708
Trackback(0)
Comments (0)

Write comment