开发者

Executing Curl for maximum 5 minutes

开发者 https://www.devze.com 2023-03-23 19:13 出处:网络
In my actions class in symfony, i\'m sending a curl_exec to a url lik开发者_Go百科e this $headerinfo = apache_request_headers();

In my actions class in symfony, i'm sending a curl_exec to a url lik开发者_Go百科e this

$headerinfo = apache_request_headers();
curl_setopt($ch1, CURLOPT_URL, $returnurl);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $rtyinstance);
curl_setopt($ch1, CURLOPT_USERAGENT,$headerinfo['User-Agent']);
$result = curl_exec($ch1);
$responseCode = curl_getinfo($ch1, CURLINFO_HTTP_CODE);

It is executing but the execution runs indefinitely i want to execute this only for 5 minutes and then register into error log if it is not 200

I checked set_time_limit but it for the whole page or actions which i cannot use..... Please tell me how to do that.......


curl_setopt($ch1, CURLOPT_TIMEOUT, 5 * 60);
0

精彩评论

暂无评论...
验证码 换一张
取 消