【发布时间】:2017-11-09 16:09:16
【问题描述】:
我了解了linkedin api,所以首先我需要知道我如何请求授权码?
我在这里尝试了很多关于这种类型的问题,但我仍然理解。
从docs据说:
“简单调用”:
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=123456789&redirect_uri=https%3A%2F%2Fwww.example.com%2Fauth%2Flinkedin&state=987654321&scope=r_basicprofile
但我需要知道如何使用php 执行该调用。
我试试:
$response = file_get_contents("https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=123456789&redirect_uri=https%3A%2F%2Fwww.example.com%2Fauth%2Flinkedin&state=987654321&scope=r_basicprofile");
$response = json_decode($response);
var_dump($response);
来自answer,但我的回报是:NULL。
编辑
我的 oAuth2.0 授权端点是 http://localhost,我不知道这是否有问题或可能。
我也放了curl标签,因为这方面的教学很受欢迎。
对不起我的英语
【问题讨论】:
-
Tks for Attention @TahaPaksu ,但是在这个例子中 retun
404,可能是 url 请求上的一些错误,我检查了很多次 url 参数,听起来不错,但不起作用... -
欢迎否定,当遵循任何提示以更好地提问时,它会带来什么好处?
标签: php api curl linkedin file-get-contents