Search code examples
phphttpful

Timeout not working in PHP Httpful request


I am having an http request and I am using "Httpful Request" to send it in PHP. I am setting a timeout of 20 seconds also in the request as follows:

$req = Request::get($Url);
$response = $req->timeoutIn(20)->expectsHtml()->send();

I was expecting to get an exception after timeout happens and I can handle the exception. But I am getting the following php Fatal error. Why is it so?

PHP Fatal error: Maximum execution time of 30 seconds exceeded in phar://C:/CapPortal/cpPortal/source/wordpress/httpful.phar/Httpful/Request.php on line 202


Solution

  • You can use set_time_limit($seconds) to set that limit higher, if you need more execution time. You can also set it to 0, which means infinite. Warning: Apache (if you're using php with it) may also limit php's execution time.