Ich habe eine Klasse geschrieben, um die Verwendung mehrerer cURL-Anfragen zu erleichtern. Ich möchte Fehler protokollieren, wenn ein 404-Fehler oder ein anderer Fehler auftritt. Ich habe bereits CURLOPT_FAILONERROR
auf True eingestellt.Wie kann man wissen, welche URL in curl_multi_exec fehlgeschlagen ist?
Ich verwende derzeit curl_multi_info_read()
.
und dies ist mein Code:
$active = null;
do {
$multi_exec = curl_multi_exec($this->_multi_handle, $active);
} while ($multi_exec == CURLM_CALL_MULTI_PERFORM);
while ($active && $multi_exec == CURLM_OK) {
if (curl_multi_select($this->_multi_handle) != -1) {
do {
$multi_exec = curl_multi_exec($this->_multi_handle, $active);
$info = curl_multi_info_read($this->_multi_handle);
if ($info['result'] != 0) {
$this->_errors[] = $info; // currently storing the whole array
}
} while ($multi_exec == CURLM_CALL_MULTI_PERFORM);
}
}
Das Ergebnis auf Fehler ist ein Array wie folgt:
Array
(
[0] => Array
(
[msg] => 1
[result] => 22 // on success this is 0
[handle] => Resource id #4 // does this help in finding the url if I have the handle ID ?
)
Wie kann ich die URL, wo der Fehler passiert ist? dies gibt mir nur die Handle-Ressource ID
und danke im Voraus.