PHP 8.3.4 Released!

curl_strerror

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

curl_strerrorHata kodunun açıklamasını döndürür

Açıklama

curl_strerror(int $hata_kodu): ?string

Belirtilen cURL hata kodunu açıklayan hata iletisini döndürür.

Bağımsız Değişkenler

hata_kodu

» çoklu cURL hata kodu sabitlerinden biri.

Dönen Değerler

Hata kodu geçerliyse hata kodunu açıklayan bir dizge, geçersizse null döner.

Örnekler

Örnek 1 - curl_errno() örneği

<?php
// URL'de yanlış yazılmış protokol ile bir cURL tanıtıcısı oluştur
$ch = curl_init("htp://example.com/");

// İsteği gönder
curl_exec($ch);

// Hatalara bak ve hata iletisini göster
if($errno = curl_errno($ch)) {
$error_message = curl_strerror($errno);
echo
"cURL error ({$errno}):\n {$error_message}";
}

// Tanıtıcıyı kapat
curl_close($ch);
?>

Yukarıdaki örneğin çıktısı:

cURL error (1):
 Unsupported protocol

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top