Php 如何解析LinkedIn页面
有人能帮我如何用curl解析这个链接吗 这是我的密码: 只需运行它并查看结果:Php 如何解析LinkedIn页面,php,html-parsing,Php,Html Parsing,有人能帮我如何用curl解析这个链接吗 这是我的密码: 只需运行它并查看结果: $url = "https://www.linkedin.com/in/williamhgates/"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPE
$url = "https://www.linkedin.com/in/williamhgates/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.linkedin.com/in/williamhgates/'));
$output = curl_exec($ch);
curl_close($ch);dd($output);die;
我只想在一个文件中获得整个源代码,但它显示:
Could not process this client request HTTP method request for URL
Linked in不允许所有爬虫程序,除了少数几个向它们发送流量的爬虫程序(Google bot、Bingbot等),它们已明确阻止用户代理。所以不可能向Linkedin页面发出curl请求。
但不管你怎么爬Linkedin,它都可能给你带来法律问题。因此,最好别管Linkedin 标准方式似乎不再适用于LinkedIn。
即使在iframe中放置LinkedIn页面也不起作用。您会得到一个响应,说X-Frame-Options拒绝加载:https://www.linkedin.com 不允许交叉原点框架。
Feed43过去一直工作到大约5周前,现在它得到了一个
HTTP/1.1 999请求被拒绝响应
有一个官方的LinkedIn插件,用于在您的网站上获取LinkedIn用户档案小部件-
还有其他一些插件-
但这就是这些天你所得到的。可能是缺少了像useragents这样的头文件。我尝试了不同的html\u dom和curl方法,但都不管用!如果在php.ini中启用了file_get_html,则可以使用$html=file_get_html(https://www.linkedin.com/in/williamhgates/');
并使用DOM类从中提取数据。我以前尝试过,但根本无法获取源代码。