Send Facebook App Request / Invite using Graph Api

I have the following code that would get a list of cheers friends using api chart

function getFriendsList(){ $response = $this->api('/me/friends'); return $response; } 

This returns the id and name of friends. using api chart

Then I execute this code in the joomla module:

 $fbClient = JFBConnectFacebookLibrary::getInstance(); $fbUserId = $fbClient->getUserId(TRUE); //If FB User if($fbUserId){ $f_list = $fbClient->getFriendsList(); 

after i get the array i will show firends image

 foreach ($f_list as $friend) { for($i = 0; $i < count($friend); $i++) { echo '<img src="http://graph.facebook.com/'.$friend[$i]['id'].'/picture"><br/>'; } } } 

This will create profile pictures of my friends.

My question is how to create onlick, even if I click on the photo, I can send an individual request to the facebook application. ???

+4
source share
2 answers

Facebook application request submission is not available through the api schedule. You can use the javascript dialog application to send the request, but you just need to specify the user ID in the "to" property, as described in the documentation.

Function example:

 <script> FB.init({ appId: '**appId**', status: true, cookie: true, xfbml : true }); function sendRequest(to) { FB.ui({method: 'apprequests', to: to, message: 'You should learn more about this awesome site.', data: 'tracking information for the user'}); return false; } </script> 

Then just connect onclick for each image to something like onclick="return sendRequest('**friendId**');"

+6
source

I had the same problem. Although the answer to the question is very late, it will help someone. That is why the answer to this question.

Instead, you can call this function in javascript: it will give you all the friends with the photos. Also a group of friends who are currently using the same application. You can send a request to any of them.

 function sendRequestViaMultiFriendSelector() { FB.ui({ method: 'apprequests', message: "You should learn more about this awesome site." }); } 
+5
source

All Articles