php - Timeout and unset 1 query in multi curl
I have php script that send request to the other server.
If the question similar to each other, I using multi curl
try {
$result['response'][] = @new SimpleXMLElement($task);
$result['request'][] = @new SimpleXMLElement($request);
} catch (Exception $e) {
// Showing err
if ($throwException) {
throw new Exception('Internal Server Error', 500);
}
}
If any problem with answer I showing an error.
I want to know:
1) How to understand that it was timeout error or something else?
$cmh = curl_multi_init(); // create only one descriptor
If I send 5 request, 4 will be ok, and by 1 will be timeout()
2) How to unset only this one request in multi curl?
Thanks!
Answer
Solution:
I'd recommend this CURL class:
http://semlabs.co.uk/journal/object-oriented-curl-class-with-multi-threading
I may have some of the variables in the foreach wrong there. Just print_r( $r['info'] ); and you will get all the details for each request. This also has a retry for failed requests ($curl->retry = 2;).