I have a function that I need to timeout and output an error message.
I have found the set_time_limit() function, but I dont think I am using it right.
I have tried...
... some code ...
set_time_limit(12);
$client->sendHttp(URL, TIMEOUT_CONNECT, TIMEOUT_READ);
if (set_time_limit(12) != true){
$_SESSION['Message'] = "Transaction Timed Out!";
}
... some code ...
That's the best I could come up with but it doesn't work. Can you suggest anything?
set_time_limit
limits the scripts time, the script all together will end after that amount of time no code will be executed after that
$client->sendHttp
should return false, null if a timeout has been reached, read the documentation on that function to see what it will actually return.