curl - PHP curl_exec times out, from command line I get instant answer -


i'm developing script i'm using php , curl fetch data rest web service.

my problem curl_exec times out in php script, when try same request command line curl client instant answer.

it seems php curl somehow caches timeout time , decides it's going fetch data need. multiple reloads produces same result: timeout. , after few minutes works fine. command line curl client has been getting data time.

what can wrong?

try use curl setting:
curl_setopt($curl_handler, curlopt_fresh_connect, true);

also setting useful, forces connection close after request completed:
curl_setopt($curl_handler, curlopt_forbid_reuse, true);


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -