从apprequest facebook api请求数据
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从apprequest facebook api请求数据相关的知识,希望对你有一定的参考价值。
Rescatamos los datos que pasamos por apprequest .
//Código javascript function sendRequest(user) { FB.ui({ method: 'apprequests', title: 'Concurso Hipoglos', data: '{"item_id":'+user+',"item_type":"plant"}' }, function (response) { if (response && response.request_ids) { alert('Tus invitaciones han sido enviadas, tus amigos recibiran una notificacion para subir a tu bus. Recueda que estas participando cuando tengas 20 pasajeros en el bus.'); } else { //Do something if they don't send it. } }); } //Rescatando datos desde php // Requesting an application token $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $fbconfig['appid' ] . "&client_secret=" . $fbconfig['secret'] . "&grant_type=client_credentials"; // You may have more than one request, so it's better to loop foreach($requests as $request_id) { // Get the request details using Graph API $request_content = json_decode(file_get_contents("https://graph.facebook.com/$request_id?$app_token"), TRUE); // An example of how to get info from the previous call $from_id = $request_content['from']['id']; $to_id = $request_content['to']['id']; // An easier way to extract info from the data field // Now that we got the $item_id and the $item_type, process them // Or if the recevier is not yet a member, encourage him to claims his item (install your application)! $redirect_from_app = $fbconfig['appUrl'] . "&app_data=" . $item_id; $loginUrl = $facebook->getLoginUrl(array('scope' => 'email,publish_stream', 'redirect_uri' => $redirect_from_app)); // When all is done, delete the requests because Facebook will not do it for you! //$deleted = file_get_contents("https://graph.facebook.com/$request_id?$app_token&method=delete"); // Should return true on success } }
以上是关于从apprequest facebook api请求数据的主要内容,如果未能解决你的问题,请参考以下文章
如何分离已删除的 facebook apprequest 消息?
Facebook 加载后来自 apprequest 的通知消失
Apprequest,pasar parametros e invitar朋友,facebook