Php 使用LinkedIn API获取我自己的完整配置文件
出于测试目的,我想从LinkedIn API获取我自己的完整配置文件数据 到目前为止,我的代码如下所示:Php 使用LinkedIn API获取我自己的完整配置文件,php,linkedin,Php,Linkedin,出于测试目的,我想从LinkedIn API获取我自己的完整配置文件数据 到目前为止,我的代码如下所示: // Fill the keys and secrets you retrieved after registering your app $oauth = new OAuth("APIKEY", "SECRETKEY"); $oauth->setToken("Token OAuth", "Secret User OAuth"); $oauth->disa
// Fill the keys and secrets you retrieved after registering your app
$oauth = new OAuth("APIKEY", "SECRETKEY");
$oauth->setToken("Token OAuth", "Secret User OAuth");
$oauth->disableSSLChecks();
$params = array();
$headers = array();
$method = OAUTH_HTTP_METHOD_GET;
// Specify LinkedIn API endpoint to retrieve your own profile
$url = "https://api.linkedin.com/v1/people/~:(first-name,last-name,headline,location:(name),skills:(name),educations:(id,school-name,field-of-study))?format=json";
// By default, the LinkedIn API responses are in XML format. If you prefer JSON, simply specify the format in your call
// $url = "https://api.linkedin.com/v1/people/~?format=json";
// Make call to LinkedIn to retrieve your own profile
$oauth->fetch($url, $params, $method, $headers);
$oProfile = json_decode($oauth->getLastResponse());
var_dump($oProfile);
虽然我得到了基本的个人资料信息(名字、标题等),但当涉及到完整的个人资料信息时,我每次都会得到一个以“…”作为值的对象,尽管这些信息存在
我在我的LinkedIn应用程序界面中勾选了r_fullprofile,所以我不知道我要做什么才能获得这些值。我用我自己的帐户尝试了你的查询。看来你的问题出在技能领域 你可以在LinkedIn API中看到技能由一个技能组成,每个技能都有一个名称。如果您只想返回名称,那么正确的请求方式是
skills:(skill:(name))
,而您的请求要求skills:(name)
以下是您的最新请求:
GET https://api.linkedin.com/v1/people/~:(first-name,last-name,headline,location:(name),skills:(skill:(name)),educations:(id,school-name,field-of-study))?format=json
要获得更多详细信息,如技能、教育等,您需要申请以获得完整的个人资料详细信息。