2012-08-23 217 views
0

雖然Facebook文件似乎完成了貶低離線訪問令牌,但我似乎對我自己的案例感到困惑。我的訪問令牌已經減少到大約兩個小時,從CRON工作中運行我的頁面,導致混亂。直到上週,它運行良好大約四個月。Facebook頁面長期訪問令牌

這是我的代碼。任何想法在這裏添加什麼?我擁有manage_pages權限,正如我所說,它曾經工作得很好。

try { 
$page_info = $facebook->api("/$news_page?fields=access_token"); 
if (!empty($page_info['access_token'])) { 
    $tkk = $page_info['access_token']; 
    $r = mysql('database', "update facebook set access_token = '$tkk' where email='$news_email'"); 

    $args = array(
     'access_token' => $page_info['access_token'], 
     'message'  => $u, 
     'link'   => $news_url, 
     'description' => $news_text, 
     'name'   => $news_title, 
     'picture'  => $image 
    ); 

    $post_id = $facebook->api("/$news_page/feed","post",$args); 
} 
} catch (FacebookApiException $e) { 
error_log($e); 
$user = null; 
} 

回答