2012-11-06 40 views
0

我想寫一個應用程序,將用戶發佈到用戶在Facebook的牆上的圖像,它一直工作,直到大約一個小時前,現在我得到一個捕獲錯誤「一個活動訪問令牌必須用於查詢有關當前用戶的信息。「希望有人有一個快速的答案:)Facebook的PHP API停止工作

這裏是我的出發PHP應該得到這個是我的主要HTML(上面是DOCTYPE之前調用)的用戶,並檢查專輯

<?php 
    include 'src/facebook.php'; 
    $facebook = new Facebook(array(
     'appId' => ID, 
     'secret' => SECRET, 
     'cookie' => true 
     )); 

    $me = null; 
    $thisPhoto = null; 
    $album_name = NAME; 
    $album_message = MESSAGE; 

    try { 
     $me = $facebook->api('/me'); 
     $facebook->setFileUploadSupport(true);  
     // check if album with name exists...if not create it 
     $albums = $facebook->api('/me/albums'); 
     foreach($albums['data'] as $album) { 
      if($album['name'] == $album_name) { 
       $album_uid = $album['id']; 
       } 
      } 
     if (!$album_uid) { 
      $album_details = array(
       'message'=> $album_message, 
       'name'=> $album_name 
       ); 
      $create_album = $facebook->api('/me/albums', 'post', $album_details); 
      $album_uid = $create_album['id'] . "MADE"; 
      } 
     //echo "<!-- $album_uid -->\n"; 
     } 
    catch (FacebookApiException $e) { 
     echo "<!-- " . $e->getMessage() . " -->\n"; 
     } 
?> 

<!doctype> 
<html> 
    <head> 
     <meta charset=utf-8> 
     <title>'TITLE</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
     <style type="text/css" media="screen"> 
      html, body { width:100%; background-color: #FFF;} 
      body { margin:0 auto; padding:0; width:760px} 
      #flashContent { width:100%; height:100%; } 
     </style> 
    </head> 
<body> 

<?php 
    //print_r($me); 
    //echo $facebook->getUser(); 
    //echo $facebook->getAccessToken(); 

    // START 
    if($me) { 
     // true makes print_r give human readable instead of just a screen dump 
     //echo '<pre>' . print_r($VARIABLE, true) . '</pre>'; 
     $appName = NAME.SWF; 
     $appWidth = "760"; 
     $appHeight = "640"; 
     $appID = "stache_yerself"; 
     $appAlt = "Square Shooters app - 'Stache Yerself"; 
     // ECHOS out HTML used for the APP 
    } 
    else { 
     $loginUrl = $facebook->getLoginUrl(array('scope' => 'publish_stream,read_friendlists,user_photos')); 
     echo '<a href="' . $loginUrl . '">Login</a>'; 
    } 
?> 
</body> 
</html> 

上面的else給出了一個鏈接,然而,它沒有做任何事情,只是進入一個空白頁面。我重置應用程序開發者頁面上的「祕密」,但沒有幫助。我不知道爲什麼它停止工作(Facebook再次改變他們的代碼?)。即使從HTML部分登錄的東西在工作之前,現在...什麼也沒有。我難以理解,爲什麼這只是停止工作。

回答