2013-06-26 45 views
0

我無法發佈通知。 這是我的PHP代碼:#15發佈通知

try { 
     $id = Fb_Config::get_app_id(); 
     $secret = Fb_Config::get_secret_code(); 
     $url = "https://graph.facebook.com/oauth/access_token?client_id=$id&client_secret=$secret&grant_type=client_credentials"; 
     $appAccessToken = end(explode("=", file_get_contents($url), 2)); 
     var_export(Fb_Facebook::get()->api_post("/".$this->get_logged_in_user()->get_id()."/notifications?access_token=$appAccessToken", array(
      href => "http://www.disney.com", 
      template => "this is awesome" 
     ))); 
    } catch (Exception $e) { 
     echo "<pre>Error: "; 
     echo $e->getMessage(); 
     echo "</pre>"; 
    } 

的錯誤是:

錯誤:(#15),這個方法必須與一個應用程序來的access_token叫。

回答

1

不要讓它比它更復雜 - app_id | app_secret(中間的管道符號)的組合作爲應用程序訪問令牌。