curl不为linkedin工作我的关系简介


curl not working for linkedin profile of my connections

我想从linkedin获得我朋友的电子邮件id。到目前为止,我得到了我的网站的网址请求网址的朋友。这就像https://www.linkedin.com/profile/view?id=xxx&authType=名称&authToken=xxx&trk=api*a4152951*s4217191*

(Linkedin API IN.API.连接("我").结果(函数(我){})

从这个网址我必须得到电子邮件地址。所以我用的是旋度。这是我的代码:

$ch = curl_init("https://www.linkedin.com/profile/view?id=259116153&authType=name&authToken=S9sN&trk=api*a4152951*s4217191*");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
$rr = curl_exec($ch);
//curl_close($ch);
echo $rr;

我也尝试过这个,但没有工作(空白页):

$url = $_POST['links'];
$contents = file_get_contents($url);
$dom = new DOMDocument();
@$dom->loadHTML($contents);
$dom->preserveWhiteSpace = false;
$xpath = new DOMXPath($dom);
$hrefs = $xpath->query("//li[@id='contact-field']");
for ($i = 0; $i < $hrefs->length; $i++)
  echo $hrefs->item($i)->nodeValue;
if(!$hrefs) echo 'Not found';
echo $hrefs->nodeValue;

还有一件事,如果把这个url放在浏览器中,我可以通过点击显示的conatct信息按钮来查看电子邮件:block(CSS)。

我们的使用条款明确禁止从LinkedIn中删除数据。检索数据的正确方法是通过REST API调用。

请求领英会员的电子邮件地址需要您的应用程序请求一个名为:r_emailaddress 的特殊OAuth权限

确保您的应用程序配置为请求该权限,然后使用以下REST API调用检索成员的电子邮件地址:

https://api.linkedin.com/v1/people/id={targetMemberID}:(email-address)

有关进行REST API调用的其他信息可以在此处找到:https://developer.linkedin.com/documents/profile-api