Php disqs身份验证返回空数据

Php disqs身份验证返回空数据,php,Php,我正在尝试使用Disqs身份验证创建一个登录系统,但即使我完全按照他们的教程进行操作,用户也可以访问他们的系统,但我没有得到任何数据。。。一切返回为空 <?php //This is a all-in-one example of API authentication and making API calls using OAuth //More information on using OAuth with Disqus can be found here: http://di

我正在尝试使用Disqs身份验证创建一个登录系统,但即使我完全按照他们的教程进行操作,用户也可以访问他们的系统,但我没有得到任何数据。。。一切返回为空

    <?php

//This is a all-in-one example of API authentication and making API calls using OAuth
//More information on using OAuth with Disqus can be found here: http://disqus.com/api/docs/auth/

//error_reporting(E_ALL ^ E_NOTICE) ;

$PUBLIC_KEY = "mypk";
$SECRET_KEY = "mysk";
$redirect = "returning addr";

$endpoint = 'https://disqus.com/api/oauth/2.0/authorize?';
$endpoint = 'https://disqus.com/api/oauth/2.0/authorize/?';
$client_id = $PUBLIC_KEY;
$scope = 'read,write';
$response_type = 'code';

$auth_url = $endpoint.'&client_id='.$client_id.'&scope='.$scope.'&response_type='.$response_type.'&redirect_uri='.$redirect;

echo $auth_url;

// Trigger the initial authentication call to receive a code
echo "<h3>Trigger authentication -> <a href='".$auth_url."'>OAuth</a></h3>";


// Get the code to request access
$CODE = $_GET['code'];

if($CODE){

echo '<br>' . $CODE . '<br>';

// Build the URL and request the authentication token
extract($_POST);

$authorize = "authorization_code";

$url = 'https://disqus.com/api/oauth/2.0/access_token/?';
$fields = array(
  'grant_type'=>urlencode($authorize),
  'client_id'=>urlencode($PUBLIC_KEY),
  'client_secret'=>urlencode($SECRET_KEY),
  'redirect_uri'=>urlencode($redirect),
  'code'=>urlencode($CODE)
);

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, "&");

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

//execute post
$data = curl_exec($ch);

print_r($data);

//close connection
curl_close($ch);
}
?>


是的,我试图在这里找到一些可以帮助我的东西…

尝试
var\u dump
而不是
print\r
它返回bool(false)