如何避免“HTTP/1.1 999 请求被拒绝"来自LinkedIn的回应? [英] How to avoid "HTTP/1.1 999 Request denied" response from LinkedIn?
问题描述
我正在向 LinkedIn 页面发出请求并收到HTTP/1.1 999 请求被拒绝"响应.我使用 AWS/EC-2 并得到此响应.在本地主机上一切正常.
I'm making request to LinkedIn page and receiving "HTTP/1.1 999 Request denied" response. I use AWS/EC-2 and get this response. On localhost everything works fine.
这是我获取页面 html 代码的代码示例.
This is sample of my code to get html-code of the page.
<?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 标签).
I don't need whole page content, just meta-tags (title, og-tags).
推荐答案
请注意,W3C 超文本传输协议 - HTTP/1.1,可能这个错误是自定义的(听起来像个笑话)
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"的可能原因应该是:
LinkedIn don't allow direct access, the probable reason of them blocking any "url" from others webservers access should be to:
- 防止未经授权的信息复制
- 防止入侵
- 防止滥用请求.
- 强制使用 API
某些服务器的IP地址被屏蔽,因为国内ISP"的IP"没有被屏蔽,并且当您访问LinkedIn 与网络浏览器,您使用您的互联网提供商的 IP.
Some IP addresses of servers are blocked, as the "IP" from "domestic ISP" are not blocked and that when you access the LinkedIn with web-browser you use the IP of your internet provider.
访问数据的唯一方法是使用它们的 API.见:
The only way to access the data is to use their APIs. See:
注意:Google 和 Bing 可能将他们的 IP 放在白名单"中.
Note: The search engines like Google and Bing probably have their IPs in a "whitelist".
这篇关于如何避免“HTTP/1.1 999 请求被拒绝"来自LinkedIn的回应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!