使用需要使用HTTPS,并检查启用了哪些包装器
在 Windows 上,您应该在 php.ini 中看到它
extension=php_openssl.dll
检查包装
<?php
    var_dump(stream_get_wrappers());
?>
哪个应该给出输出,例如
array(12) {
  [0]=>
  string(5) "https"
  [1]=>
  string(4) "ftps"
  [2]=>
  string(13) "compress.zlib"
  [3]=>
  string(14) "compress.bzip2"
  [4]=>
  string(3) "php"
  [5]=>
  string(4) "file"
  [6]=>
  string(4) "glob"
  [7]=>
  string(4) "data"
  [8]=>
  string(4) "http"
  [9]=>
  string(3) "ftp"
  [10]=>
  string(4) "phar"
  [11]=>
  string(3) "zip"
注意 HTTPS 在数组中。
如何获取令牌的完整示例
<?php 
    $app_id = "YOUR_APP_ID";
    $app_secret = "YOUR_APP_SECRET";
    $app_token_url = "https://graph.facebook.com/oauth/access_token?"
        . "client_id=" . $app_id
        . "&client_secret=" . $app_secret 
        . "&grant_type=client_credentials";
    $response = file_get_contents($app_token_url);
    $params = null;
    parse_str($response, $params);
    echo("This app's access token is: " . $params['access_token']);
 ?>
http://developers.facebook.com/docs/howtos/login/login-as-app/