php - Can servers block curl requests specifically? -


generally speaking, possible server block php curl request?

i've been making curl requests every 15 minutes public-facing url 6-8 months. other day stopped working, , url started returning empty string.

when hit url in browser or python request, returns expected data.

i decided try hitting same url file_get_contents() function in php, , works expected well.

since found bandaid solution now, there difference between default headers curl sends vs file_get_contents() allow 1 request blocked , other through?

generally speaking, possible server block php curl request?

sort of. server can block requests if user agent string looks comes curl. try using -a option set custom user agent string.

curl -a "foo/1.1" <url> 

edit: oops see said "from php", set curlopt_useragent option:

curl_setopt($curl, curlopt_useragent, 'foo/1.1'); 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -