cURL curl_strerror

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

curl_strerror — 주어진 오류 코드를 설명하는 반환 문자열


설명

curl_strerror(int $error_code): ?string

주어진 오류 코드를 설명하는 텍스트 오류 메시지를 반환합니다.


매개변수

error_code
» cURL 오류 코드 상수 중 하나입니다.

반환 값

오류 설명을 반환하거나 잘못된 오류 코드에 대해 null을 반환합니다.


Examples

예제 #1 curl_errno() 예제

                  
<?php
// Create a curl handle with a misspelled protocol in URL
$ch = curl_init("htp://example.com/");

// Send request
curl_exec($ch);

// Check for errors and display the error message
if($errno = curl_errno($ch)) {
    $error_message = curl_strerror($errno);
    echo "cURL error ({$errno}):\n {$error_message}";
}

// Close the handle
curl_close($ch);
?>
                  
                

위의 예는 다음을 출력합니다.

cURL error (1):
 Unsupported protocol
                

기타