Skip to content
Advertisement

PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?

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.

So i think they have done some restriction to cURL.

Then my questions here are:

  1. Can a Server restrict/block the cURL incoming requests?
  2. If so, can i trick/change the HTTP Header (User Agent) in my initiating cURL script?
  3. Or is there any other possible stories?

Thanks!

Advertisement

Answer

  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.

  2. 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)

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

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement