php - Dsetiny2 API,PHP OAuth 身份验证访问令牌无响应
问题描述
我尝试使用https://github.com/Bungie-net/api/wiki/OAuth-Documentation的“访问令牌请求”中描述的内容进行 POST ,但没有响应。为什么。
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.bungie.net/Platform/App/OAuth/Token/ HTTP/1.1?client_id=12345&grant_type=authorization_code&code=".$_GET['code']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
$json = json_decode(curl_exec($ch));
curl_close($ch);
echo('<pre>');
var_dump($json);
echo('</pre>');
?>
$ _GET ['code'] 是对通过 OAuth 身份验证重定向的 URL 的查询。
解决方案
推荐阅读
- python - StopIteration 不会被 main() 捕获
- javascript - react-native-image-to-pdf 尝试调用虚拟方法错误
- pandas - 计算从日期时间列到特定日期的天数 - 熊猫
- sqlite - Flutter:在我的应用程序中放置 sqflite 代码的位置?
- javascript - 使用用户输入的电子邮件地址将 HTML/Js 页面结果发送到邮箱
- browser - YouTube API 是否依赖于特定的浏览器?
- python - 无法绘制图像
- python - 我不知道为什么相同的代码适用于 Julia 而不适用于 Mandelbrot?
- c++ - C ++ udp boost客户端不接收udp消息
- java - 在android中启动空活动后出错