6
複数のcURLリクエストを簡単に使用できるようにクラスを作成しました。404エラーまたはその他のエラーが発生したときにエラーをログに記録します。 すでにCURLOPT_FAILONERROR
がtrueに設定されています。curl_multi_execでどのURLが失敗したかを知るには?
私は現在curl_multi_info_read()
を使用しています。
、これは私のコードです:
$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);
}
}
エラーの結果は、このような配列である:
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 ?
)
は、どのように私は、エラーが起こったURLを得ることができますか?これは私にハンドルリソースID
を与えてくれてありがとうございます。