Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Fabio here is the php post snippet that i was able to get working. Snippet includes a curl to get application access token and the api post to like an object, in this case a post on my app.</p> <ul> <li>The Sample post is here: Shows the post to be liked</li> </ul> <p><a href="https://shawnsspace.com/plugins/TimeLinePost.php?pageid=135669679827333&amp;postid=135669679827333_151602784936066&amp;type=feed&amp;fh=750" rel="nofollow">https://shawnsspace.com/plugins/TimeLinePost.php?pageid=135669679827333&amp;postid=135669679827333_151602784936066&amp;type=feed&amp;fh=750</a></p> <ul> <li>The Like Page is here: Should Return whether the user likes or not, or login if not connected. <a href="https://shawnsspace.com/plugins/TheLike.php?postid=135669679827333_151602784936066" rel="nofollow">https://shawnsspace.com/plugins/TheLike.php?postid=135669679827333_151602784936066</a></li> </ul> <h2><strong>Getting the Application Access Token.</strong></h2> <pre><code>function GetCH(){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&amp;client_secret=YOUR_APP_SECRET&amp;grant_type=client_credentials"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT_MS,20000); if(substr($url,0,8)=='https://'){ // The following ensures SSL always works. A little detail: // SSL does two things at once: // 1. it encrypts communication // 2. it ensures the target party is who it claims to be. // In short, if the following code is allowed, CURL won't check if the // certificate is known and valid, however, it still encrypts communication. curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_ANY); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); } $sendCH = curl_exec($ch); curl_close($ch); return $sendCH; }; $app_access_token = GetCH(); </code></pre> <h2><strong>Looking in url for postid parameter then liking id</strong></h2> <pre><code> if($_GET['postid']){ $postid = $_GET['postid']; }else{ $postid = '135669679827333_151602784936066'; } if($user){ $pageLike = $facebook-&gt;api('/'.$postid.'/likes?access_token='.$access_token.'&amp;method=post', 'POST'); } </code></pre>
 

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