PHP cURL如何添加用户代理值或克服服务器阻塞cURL请求? [英] PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?

查看:279
本文介绍了PHP cURL如何添加用户代理值或克服服务器阻塞cURL请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在传输对象数组。我在自己的服务器和其他服务器上的侦听脚本上有一个 cURL客户端(提交者),不受我的控制。然后我认为,他们阻塞了传入的cURL请求,因为当我测试与正常的HTML < form> ,它是工作。但不是通过cURL。

I am transferring an Object Array. I have a cURL client (submitter) on own Server and listening script on other's Server, which one is not under my control. Then i think there, they are blocking the incoming cURL requests because when i test with the normal HTML <form>, it is working. But not via cURL anyway.

所以我认为他们对cURL做了一些限制。

So i think they have done some restriction to cURL.

这里是:


  1. 服务器可以限制/阻止cURL传入的请求吗?

  2. 我可以在我启动的cURL脚本中欺骗/更改HTTP头(用户代理)?

  3. 还是有其他可能的故事吗?

感谢!

推荐答案


  1. 侧,我们可以通过识别http请求中的头字段(包括refer,cookie,user-agent等等)来阻止一些请求,ip地址,访问频率。在大多数情况下,机器产生的请求通常具有不同于人类请求的东西,例如,没有引用& Cookie或更高的访问频率,我们可以编写一些规则来拒绝这些请求。

  1. In the server side, we can block some requests by recognize the header fields(including refer, cookie, user-agent and so on) in http request, the ip address, access frequency. And in most case, requests generated by machine usually has something different than human requests,for example, no refer & cookie, or with higher access frequency, we can write some rules to deny these requests.

根据1,您可以尽量模拟真实请求填充报头字段,使用随机和较慢的频率,使用更多的IP地址。 (听起来像攻击)

According to 1, you can try your best to simulate real requests by filling the header fields, using random and slower frequency, using more ip addresses. (sounds like attack)

一般来说,使用较低频率并且不会对服务器造成严重负载,请遵循其访问规则,他们很少阻止您的请求。

Generally, using lower frequency and do not make heavy load for their server, follow their access rules, they will seldom block your requests.

这篇关于PHP cURL如何添加用户代理值或克服服务器阻塞cURL请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆