开发者

Executing Curl for maximum 5 minutes

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜