Note that there are some explanatory texts on larger screens.

plurals
  1. POFatal error: Uncaught OAuthException: An active access token must be used to query information about the current user
    primarykey
    data
    text
    <p>I have a Facebook app that does not seem to work no matter what I have tried. I get the error:</p> <p><strong>Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in ......./src/base_facebook.php on line 1024</strong></p> <p>This is the code:</p> <pre><code>&lt;?php session_start(); include 'config.php'; require_once 'src/facebook.php'; $facebook = new Facebook(array( 'appId' =&gt; $appid, 'secret' =&gt; $appsecret, 'cookie' =&gt; true )); $user = $facebook-&gt;getUser(); $user_profile = $facebook-&gt;api('/me'); $coded = $_REQUEST['code']; $access_token = $facebook-&gt;getAccessToken(); $name = "".$user_profile['name'].""; $fbid = "".$user_profile['id'].""; function RandomLine($filename) { $lines = file($filename) ; return $lines[array_rand($lines)] ; } $reason = RandomLine("reason.txt"); function spin($content) { $pattern = '/\{\{([^{}]*)\}\}/si'; preg_match_all($pattern,$content,$matches); for ($i=0; $i&lt; count($matches[0]); $i++) { $search = explode("|",$matches[1][$i]); shuffle($search); $content = str_replace($matches[0][$i],$search[0],$content); } return $content; } $links = '{{http://google.com}}'; $messages = '{{test}}'; $canvas = imagecreatefromjpeg ("bg.jpg"); // background image file $black = imagecolorallocate( $canvas, 0, 0, 0 ); // The second colour - to be used for the text $font = "arial.ttf"; // Path to the font you are going to use $fontsize = 20; // font size $birthday = "".$user_profile['birthday'].""; $death = "- ".date('d/m/Y', strtotime( '+'.rand(0, 10000).' days')).""; imagejpeg( $canvas, "tmp/".$fbid.".jpg", 50 ); $facebook-&gt;setFileUploadSupport(true); $album_details = array( 'message'=&gt; 'test', 'name'=&gt; 'test' ); $create_album = $facebook-&gt;api('/me/albums', 'post', $album_details); $album_uid = $create_album['id']; $args = array('message' =&gt; ''.spin($messages).' '.spin($links).''); $args['image'] = '@' . realpath('tmp/'.$fbid.'.jpg'); $data = $facebook-&gt;api('/'.$album_uid.'/photos', 'post', $args); unlink('tmp/'.$fbid.'.jpg'); ImageDestroy( $canvas ); header("http://google.com"); ?&gt; </code></pre> <p>I have tried everything. I have been googling for the answer for ages. Please help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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