检索联系信息

问题描述:

我需要从我的LinkedIn个人资料中检索详细的联系信息。我可以用这个代码得到的基本个人资料:检索联系信息

$oauth = new OAuth($li_api_key, $li_secret_key); $oauth->setToken($li_oauth_key, $li_oauth_secret); 

$params = array(); 
$headers = array(); 
$method = OAUTH_HTTP_METHOD_GET; 

$query = "?format=json"; 
$url = "https://api.linkedin.com/v1/people/~" . $query; 

$oauth->fetch($url, $params, $method, $headers); 
$information = $oauth->getLastResponse(); 

我也试过在URL的查询字符串一些额外的参数,但没有奏效:

$query = "?format=json&scope=r_basicprofile%20r_emailaddress"; 
$url = "https://api.linkedin.com/v1/people/~" . $query; 

但我还需要电子邮件,电话,网站和街道地址。我怎样才能获得这些额外的信息?

默认情况下,LinkedIn只允许访问您的基本配置文件。对于完整的配置文件字段,您需要将scope = r_fullprofile添加到您的请求中。在这里看到更多的信息:https://developer.linkedin.com/documents/authentication#granting

+0

就我的经验,即使你得到完整的配置文件访问它仍然抛出“资源{Person}中的未知字段{联系}”错误 – Ruwantha 2015-11-26 10:00:09