-1
我的如下代碼:使用PHP和想在PHP Facebook的訪問令牌(無SDK)
//Tie it all together to construct the URL
$url = "https://graph.facebook.com/oauth/access_token?client_id=[ID]&client_secret=[key]&grant_type=client_credentials";
//Make the API call
$result = file_get_contents($url);
//Decode the JSON.
$decoded = json_decode($result, true);
//Dump it out.
var_dump($decoded);
var_dump($result);
我不使用PHP SDK(臉譜)和它不工作
.. .. 我在瀏覽器中運行相同的鏈接,它可以在JSON中返回訪問令牌。
描述實際發生的情況以及從調試輸出中得到的結果 - 而不僅僅是「不起作用」。如果您只需要一個應用程序訪問令牌 - 您不需要爲此進行API調用,則應用程序ID和應用程序密鑰與之間的管道符號('id | secret')的組合總是作爲應用程序訪問令牌。 – CBroe