[英]curl not working for linkedin profile of my connections
I want email id of my friends from linkedin. 我想要我的好友的电子邮件ID。 Till now I got url of my site request url of friends. 到现在为止,我得到了我的网站的网址,要求朋友的网址。 Which is like https://www.linkedin.com/profile/view?id=xxx&authType=name&authToken=xxx&trk=api *a4152951*s4217191* 就像https://www.linkedin.com/profile/view?id=xxx&authType=name&authToken=xxx&trk=api * a4152951 * s4217191 *
(Linkedin API IN.API.Connections("me").result( function(me) { } ) (Linkedin API IN.API.Connections(“ me”)。result(function(me){})
From this url I have to get email address.So I am using curl. 我必须从这个URL获取电子邮件地址,所以我正在使用curl。 Here is my code: 这是我的代码:
$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;
I also tried this but not working (blank page): 我也尝试过此方法,但不起作用(空白页):
$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;
And one more thing if put that url in browser I can see email by click the conatct info button which make display:block (CSS). 还有一件事情,如果将该URL放在浏览器中,我可以通过单击使display:block(CSS)的连接信息按钮来查看电子邮件。
Scraping data from LinkedIn is explicitly prohibited by our Terms of Use . 我们的使用条款明确禁止从LinkedIn爬取数据。 The proper way to retrieve data would be via a REST API call. 检索数据的正确方法是通过REST API调用。
Requesting a LinkedIn member's email address requires your application to be requesting a special OAuth permission called: r_emailaddress 请求LinkedIn成员的电子邮件地址,要求您的应用程序请求特殊的OAuth权限,称为:r_emailaddress
Make sure your application is configured to request that permission, and then use the following REST API call to retrieve a member's email address: 确保将您的应用程序配置为请求该权限,然后使用以下REST API调用来检索成员的电子邮件地址:
https://api.linkedin.com/v1/people/id={targetMemberID}:(email-address)
Additional information about making REST API calls can be found here: https://developer.linkedin.com/documents/profile-api 可以在以下位置找到有关进行REST API调用的其他信息: https : //developer.linkedin.com/documents/profile-api
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.