本文介绍了如何避免" HTTP / 1.1 999请求被拒绝"从LinkedIn回应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在请求LinkedIn页面,并收到HTTP / 1.1 999请求被拒绝的回应。我使用AWS / EC-2和得到这个答复。在本地主机上一切工作正常。

这是我的code获得HTML的code页面的样本。

 < PHP
使用error_reporting(E_ALL);
$ URL ='https://www.linkedin.com/pulse/5-essential-strategies-digital-michelle';
$ CH = curl_init();
curl_setopt($ CH,CURLOPT_URL,$网址);
curl_setopt($ CH,CURLOPT_RETURNTRANSFER,真正的);
curl_setopt($ CH,CURLOPT_HEADER,真正的);
curl_setopt($沟道,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ CH,CURLOPT_FOLLOWLOCATION,真正的);
$响应= curl_exec($ CH);
$信息= curl_getinfo($ CH);
curl_close($ CH);
后续代码var_dump($响应);
后续代码var_dump($信息);
 

我不需要整个页面的内容,只是元标签(标题,OG-标签)。

解决方案

LinkedIn不允许直接访问,他们阻止来自其他Web服务器访问任何URL应该是可能的原因:

  1. 信息prevent未经授权的复制
  2. prevent入侵
  3. prevent请求的滥用。
  4. 强制使用API​​

某些IP的服务器地址被封锁,因为知识产权,从国内的ISP未被堵塞,并且,当你访问的与Web浏览器,你用你的互联网服务提供商的IP。

要访问数据的唯一方法就是使用他们的API。参见:

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.

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);

I don't need whole page content, just meta-tags (title, og-tags).

解决方案

LinkedIn don't allow direct access, the probable reason of them blocking any "url" from others webservers access should be to:

  1. Prevent unauthorized copying of information
  2. Prevent invasions
  3. Prevent abuse of requests.
  4. Force use API

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.

The only way to access the data is to use their APIs. See:

这篇关于如何避免&QUOT; HTTP / 1.1 999请求被拒绝&QUOT;从LinkedIn回应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 03:59