Note that there are some explanatory texts on larger screens.

plurals
  1. POfacebook user_id returning 0 always
    primarykey
    data
    text
    <p>Please someone help me. I trying this almost 1 month ... i want to retrieve the message and data. Im using the latest FB API, I tried my best I couldn't find whats wrong on it.Also I cant retreive <strong>user_id</strong> .. Do I need do anything on call back function?</p> <p>App url : <a href="https://apps.facebook.com/greetingz/" rel="nofollow">https://apps.facebook.com/greetingz/</a></p> <p>this is my whole code</p> <pre><code> &lt;?php session_start(); if(!empty($_REQUEST['request_ids'])) { require_once('src/facebook.php'); $config = array(); $config["appId"] = "XXXXXXXX"; $config["secret"] = "XXXXXXXXXXXX"; $config["fileUpload"] = false; // optional // Create our Application instance. $facebook = new Facebook(array( 'appId' =&gt; $config["appId"], 'secret' =&gt; $config["secret"], 'cookie' =&gt; true, )); $user_id= $facebook-&gt;getUser(); if($user_id){ try { $app_token = $facebook-&gt;getAccessToken(); $requests = explode(',',$_REQUEST['request_ids']); foreach($requests as $request_id) { $data = $facebook -&gt; api('/'.$user_id.'/apprequests?'.$app_token); //you will delete the request here $delete_url = "https://graph.facebook.com/".$request_id."_".$user_id."?".$app_token."&amp;method=delete"; $result = file_get_contents($delete_url); } } catch (FacebookApiException $e) { error_log($e); $user = null; } }else{ ?&gt; &lt;script&gt; var oauth_url = 'https://www.facebook.com/dialog/oauth/'; oauth_url += '?client_id=XXXXXXXXXX'; oauth_url += '&amp;redirect_uri=' + encodeURIComponent('https://apps.facebook.com/greetingz/'); oauth_url += '&amp;scope=user_birthday,user_events' window.top.location = oauth_url; &lt;/script&gt; &lt;?php }; } else{ ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt; &lt;script src="js/jquery-1.6.2.min.js" type="text/javascript" &gt;&lt;/script&gt; &lt;script src="Scripts/swfobject_modified.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="css/style.css"/&gt; &lt;title&gt;Greetings&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div align="center"&gt; &lt;object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="664" height="626"&gt; &lt;param name="movie" value="flash/Candle_jey.swf" /&gt; &lt;param name="quality" value="high" /&gt; &lt;param name="wmode" value="opaque" /&gt; &lt;param name="swfversion" value="6.0.65.0" /&gt; &lt;!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. --&gt; &lt;param name="expressinstall" value="Scripts/expressInstall.swf" /&gt; &lt;!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --&gt; &lt;!--[if !IE]&gt;--&gt; &lt;object type="application/x-shockwave-flash" data="flash/Candle_jey.swf" width="664" height="626"&gt; &lt;!--&lt;![endif]--&gt; &lt;param name="quality" value="high" /&gt; &lt;param name="wmode" value="opaque" /&gt; &lt;param name="swfversion" value="6.0.65.0" /&gt; &lt;param name="expressinstall" value="Scripts/expressInstall.swf" /&gt; &lt;!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --&gt; &lt;div&gt; &lt;h4&gt;Content on this page requires a newer version of Adobe Flash Player.&lt;/h4&gt; &lt;p&gt;&lt;a href="http://www.adobe.com/go/getflashplayer"&gt;&lt;img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--[if !IE]&gt;--&gt; &lt;/object&gt; &lt;!--&lt;![endif]--&gt; &lt;/object&gt; &lt;/div&gt; &lt;div class="main"&gt; &lt;div style="margin-left:300px; width:540px; margin:auto;"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;span style="font-size:18px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#603;"&gt;Greeting :&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;textarea type="text" name="message" id="msg" style="height:40px; width:350px;" &gt;&lt;/textarea&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="submit" value="Send" id="one" style="color:#CCC; background-color:#603; border:none; width:80px; height:40px;" onclick="sendRequestViaMultiFriendSelector(); return false;"&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;script&gt; FB.init({ appId : 'XXXXXXXXXXX', status : true, cookie : true, frictionlessRequests: true, oauth: true }); function sendRequestViaMultiFriendSelector() { FB.ui({method: 'apprequests', message: $("#msg").val(), },function getMultipleRequests(requestIds) { FB.api('', {"ids": requestIds }, function(response) { console.log(response); }); }, requestCallback); } function requestCallback(response) { // Handle callback here //var requestID = FB.api("/requestID", callback); alert("Post was published."); } &lt;/script&gt; &lt;div id="fb"&gt; &lt;/div&gt; &lt;?php }?&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; swfobject.registerObject("FlashID"); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload