我正在尝试回显访问令牌,并将变量设置为 false 而不是页面的值。为什么是这样?
// Get cURL resource
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADERS => 'Content-Type: application/x-www-form-urlencoded',
CURLOPT_URL => 'https://accounts.google.com/o/oauth2/token',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
code => 'SUPER SECRET',
redirect_url=> 'http://example.com/wafds.php',
client_id=> 'SECRET,
client_secret=> 'SECRET',
grant_type=> 'authorization_code'
)
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
echo json_encode($resp);