PHP curl_multi_strerror関数
(PHP 5 >= 5.5.0)
curl_multi_setopt — エラーコードを説明する文字列テキストを返します。
説明
string curl_multi_strerror ( int $errornum )
CURLM エラーコードを説明する文字列テキストを返します。
パラメータ
errornum
CURLM エラーコード内の定数の1つ。
戻り値
エラーコードを説明する文字列テキストを返し、それ以外の場合は NULL を返します。
例
例
//cURL ハンドルを作成
$ch1 = curl_init("https://www.example.com/");
$ch2 = curl_init("http://php.net/");
//バッチ cURL ハンドルを作成する
$mh = curl_multi_init();
//ハンドルをバッチハンドルに追加
curl_multi_add_handle($mh, $ch1);
curl_multi_add_handle($mh, $ch2);
//バッチハンドルを実行
do {
$status = curl_multi_exec($mh, $active);
//エラーをチェック
if($status > 0) {
//エラーメッセージを表示
echo "ERROR!\n " . curl_multi_strerror($status);
}
} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
その他の拡張モジュール
PHP cURL リファレンスマニュアル