【发布时间】:2018-05-10 15:51:16
【问题描述】:
晚上好, 我想使用 LinkedIn REST API 从人们那里收集信息,例如电子邮件名称、体验... 我使用 Ionic 3 基于 4 角度 使用此页面中的说明 https://developer.linkedin.com/docs/rest-api 没有结果 通过这个页面https://www.myprogrammingtutorials.com/linkedin-api-using-php-get-users-data.html,他给了我一个访问令牌错误 如果您有任何建议,请提前感谢您...! ?? 这是我的代码
<!-- search_link.php -->
<!DOCTYPE html>
<html>
<head>
<title>search</title>
</head>
<body>
<form method="get" action="result_link.php">
<input type="text" name="code">
<input type="submit" name="">
</form>
</body>
</html>
<!-- result_link.php -->
<?php
if(isset($_GET['code'])){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.linkedin.com/oauth/v2/accessToken");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,"grant_type=authorization_code&code=".$_GET['code']."&redirect_uri=http://localhost:80/linkedin_search/result_link.php&client_id={ID_CLIENT}&client_secret={SECRET_CLIENT}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
}
if(isset($_GET['code']) && json_decode($server_output)->access_token != ''){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.linkedin.com/v1/people/~?oauth2_access_token=".json_decode($server_output)->access_token."&format=json");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output2 = curl_exec ($ch);
curl_close ($ch);
$user_data = json_decode($server_output2);
print_r($user_data);
}
?>
【问题讨论】:
-
有什么帮助吗?
-
?????????????????????????????????????????? ??????????????????????????????????????????????????? ??????????????????????????????????????????????????? ?????????????????????????????????
标签: javascript html rest ionic3 linkedin-api