本文介绍了999 HEAD请求到LinkedIn的错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在PHP应用程序中使用curl HEAD请求来验证通用链接的有效性。我们检查状态代码,以确保用户输入的链接有效。

We're using a curl HEAD request in a PHP application to verify the validity of generic links. We check the status code just to make sure that the link the user has entered is valid. Links to all websites have succeeded, except LinkedIn.

虽然看起来是在本地工作(Mac),但当我们尝试任何Ubuntu服务器的请求时,LinkedIn会返回一个999状态码。不是一个API请求,只是一个简单的卷曲,就像我们为每一个其他链接。我们已经尝试过几个不同的机器,并尝试改变用户代理,但没有骰子。如何修改我们的curl,使工作链接返回200?

While it seems to work locally (Mac), when we attempt the request from any of our Ubuntu servers, LinkedIn returns a 999 status code. Not an API request, just a simple curl like we do for every other link. We've tried on a few different machines and tried altering the user agent, but no dice. How do I modify our curl so that working links return a 200?

示例HEAD请求:

curl -I --url https: /www.linkedin.com/company/linkedin

Ubuntu机器上的示例响应:

Sample Response on Ubuntu machine:

HTTP/1.1 999 Request denied
Date: Tue, 18 Nov 2014 23:20:48 GMT
Server: ATS
X-Li-Pop: prod-lva1
Content-Length: 956
Content-Type: text/html


$ b b

要回应@ alexandru-guzinschi一点更好。我们已尝试屏蔽用户代理。总结我们的试验:

To respond to @alexandru-guzinschi a little better. We've tried masking the User Agents. To sum up our trials:


  • Mac机+ Mac UA => 工作

  • Mac机+ Windows UA => 工作

  • Ubuntu远程计算机+(无UA更改)=> / li>
  • Ubuntu远程计算机+ Windows UA => 失败
  • / strong>
  • Ubuntu本地虚拟机(在Mac上)+(无UA更改)=> 失败

  • 本地虚拟机(Mac上)+ Windows UA => 工作

  • Ubuntu本地虚拟机strong>

  • Mac machine + Mac UA => works
  • Mac machine + Windows UA => works
  • Ubuntu remote machine + (no UA change) => fails
  • Ubuntu remote machine + Mac UA => fails
  • Ubuntu remote machine + Windows UA => fails
  • Ubuntu local virtual machine (on Mac) + (no UA change) => fails
  • Ubuntu local virtual machine (on Mac) + Windows UA => works
  • Ubuntu local virtual machine (on Mac) + Mac UA => works

现在我想他们阻止任何curl请求,不提供备用UA和 >阻止托管提供商?

So now I'm thinking they block any curl requests that dont provide an alternate UA and also block hosting providers?

有没有其他方法可以检查一个链接到linkedin是否有效,或者如果它将导致他们的404页面,从使用PHP的Ubuntu机器?

Is there any other way I can check if a link to linkedin is valid or if it will lead to their 404 page, from an Ubuntu machine using PHP?

推荐答案

看起来他们根据用户代理过滤请求:

It looks like they filter requests based on the user-agent:

$ curl -I --url https://www.linkedin.com/company/linkedin | grep HTTP
HTTP/1.1 999 Request denied

$ curl -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -I --url https://www.linkedin.com/company/linkedin | grep HTTP
HTTP/1.1 200 OK

这篇关于999 HEAD请求到LinkedIn的错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 20:53