title: *Malformed access token - but it's the token i get (PHP)
body: <p>i have this problem with my FB-App</p>
  
  <p>i have 2 files..
  1) the mainApp.php .. and ..
  2) the asyncApp.php .. (which processes data, delivers content &amp; shit..)</p>
  
  <p>and now..</p>
  
  <ul>
  <li><p>when a user logs in, everything works fine.. i get the access-token and save it to a SESSION-Var..(only mainApp.php is processed here).. but..</p></li>
  <li><p>when i call the async.php via jquery.load() e.g. .. i always get the 
  {"error":{"message":"Malformed access token .. oO</p></li>
  </ul>
  
  <p>but the token is the same i get from FB in the mainApp.php.. :(</p>
  
  <p>mainApp:
  this way i get the Token..</p>
  
  <pre><code>if(isset($_GET["code"])) {
                  $code = $_GET["code"];    
                  $url = 'https://graph.facebook.com/oauth/access_token?client_id='.$appID.'&amp;redirect_uri='.urlencode($appRedirectURI).'&amp;client_secret='.$appSecret.'&amp;code='.$code;
                  $curl_handle=curl_init();                   
                  curl_setopt($curl_handle,CURLOPT_URL,$url);
                  curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,6);
                  curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
                  $buffer = curl_exec($curl_handle);                  
                  curl_close($curl_handle); 
  
                  if(strpos($buffer, 'access_token=') === 0) {                        
                      //if you requested offline acces save this token to db for use later                        
                      $token = str_replace('access_token=', '', $buffer);
                      $_SESSION['fbToken'] = $token;                                          
  </code></pre>
  
  <p>later i call the async.php which should do a feed on the users wall..</p>
  
  <pre><code>$attachment =  array(
                          'access_token' =&gt; $_SESSION['fbToken'],
                          'message' =&gt; 'dfdfdf',
                          'name' =&gt; 'sdfdsf',
                          'link' =&gt; 'http://www.mbla.de',
                          'description' =&gt; 'sdfdsf',
                          'picture'=&gt; '',
                          'actions' =&gt; json_encode(array('name' =&gt; $action_name,'link' =&gt; $action_link))
                          );
  
                          $ch = curl_init();
                          curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/me/feed');
                          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                          curl_setopt($ch, CURLOPT_POST, true);
                          curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
                          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //to suppress the curl output 
                          $result = curl_exec($ch);
                          curl_close ($ch);
  </code></pre>
  
  <p>would be nice if someone could help me.. i'm suffering almost 2 weeks now.. :(</p>