执行Curl最多5分钟


Executing Curl for maximum 5 minutes

在symfony的actions类中,我正在发送一个curl_exec到这样的url

$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);

它正在执行,但执行无限期地运行,我想只执行5分钟,然后注册到错误日志,如果它不是200

我检查了set_time_limit,但它适用于整个页面或我不能使用.....的操作请告诉我怎么做.......

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