我正在向 LinkedIn 页面发出请求并收到“HTTP/1.1 999 请求被拒绝”响应。
我使用 AWS/EC-2 并得到此响应。
在本地主机上一切正常。
这是我获取页面 html 代码的代码示例。
<?php
error_reporting(E_ALL);
$url= 'https://www.linkedin.com/pulse/5-essential-strategies-digital-michelle';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
var_dump($response);
var_dump($info);
我不需要整个页面内容,只需要元标签(标题、OG 标签)。
最佳答案
Note that the error 999 don't exist in W3C Hypertext Transfer Protocol - HTTP/1.1, probably this error is customized (sounds like a joke)
LinkedIn 不允许直接访问,他们阻止其他网络服务器访问任何“url”的可能原因应该是:
服务器的部分IP地址被屏蔽,因为“国内ISP”的“IP”没有被屏蔽,访问LinkedIn使用网络浏览器,您可以使用互联网提供商的 IP。
访问数据的唯一方法是使用它们的 API。看:
Note: The search engines like Google and Bing probably have their IPs in a "whitelist".
关于php - 如何避免来自 LinkedIn 的 "HTTP/1.1 999 Request denied"响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27571419/