Fatal error: Maximum execution time of 60 seconds exceeded in C:wampwwwpathtoscriptCRMPicco.inc.php on line 102
I am receiving this error with the following code, the domain that I am using has been removed from my hosts file for testing purposes so that I can test where there is no connection to the server for example. Does anyone know why I would be getting this error and curl_exec doesn’t throw and exception which would be caught by the try block?
[code=php]
// create the headers
$headers = array(
“POST HTTP/1.0”,
“Content-type: text/xml;charset=”utf-8″”,
“Accept: text/xml”,
“Cache-Control: no-cache”,
“Pragma: no-cache”,
“Content-length: “.strlen($xml)
);
// create a new cURL session
$ch = curl_init();
// set a range of options for this cURL session
curl_setopt($ch, CURLOPT_URL, “www.crmpicco.co.uk/testurl.php”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // timing out after 191secs
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
// send the request and store the result in an array
try {
$data = curl_exec($ch); // <– errors here
}
catch (Exception $e) {
debug($e->getMessage());
throw new Exception(“Error with cURL request”);
}
Cheers,
Picco