HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

curl_version

Description

The curl_version of cURL for PHP gets cURL version information.

Syntax

curl_version(): array|false

Return

Returns an associative array with the following elements:

KeyValue
version_numbercURL 24 bit version number
versioncURL version number, as a string
ssl_version_numberOpenSSL 24 bit version number
ssl_versionOpenSSL version number, as a string
libz_versionzlib version number, as a string
hostInformation about the host where cURL was built
age
featuresA bitmask of the CURL_VERSION_* constants
protocolsAn array of protocols names supported by cURL
feature_listAn associative array of all known cURL features, and whether they are supported (true) or not (false)

Examples

1 · void

<?

$return = curl_version();

print_r($return);
Array
(
    [version_number] => 527361
    [age] => 11
    [features] => 1363101597
    [feature_list] => Array
        (
            [AsynchDNS] => 1
            [CharConv] => 
            [Debug] => 
            [GSS-Negotiate] => 
            [IDN] => 1
            [IPv6] => 1
            [krb4] => 
            [Largefile] => 1
            [libz] => 1
            [NTLM] => 1
            [NTLMWB] => 
            [SPNEGO] => 1
            [SSL] => 1
            [SSPI] => 
            [TLS-SRP] => 1
            [HTTP2] => 1
            [GSSAPI] => 1
            [KERBEROS5] => 1
            [UNIX_SOCKETS] => 1
            [PSL] => 1
            [HTTPS_PROXY] => 1
            [MULTI_SSL] => 
            [BROTLI] => 
            [ALTSVC] => 1
            [HTTP3] => 
            [UNICODE] => 
            [ZSTD] => 
            [HSTS] => 1
            [GSASL] => 
        )

    [ssl_version_number] => 0
    [version] => 8.12.1
    [host] => x86_64-redhat-linux-gnu
    [ssl_version] => OpenSSL/1.1.1w
    [libz_version] => 1.2.11
    [protocols] => Array
        (
            [0] => dict
            [1] => file
            [2] => ftp
            [3] => ftps
            [4] => gopher
            [5] => gophers
            [6] => http
            [7] => https
            [8] => imap
            [9] => imaps
            [10] => ldap
            [11] => ldaps
            [12] => mqtt
            [13] => pop3
            [14] => pop3s
            [15] => rtsp
            [16] => scp
            [17] => sftp
            [18] => smb
            [19] => smbs
            [20] => smtp
            [21] => smtps
            [22] => telnet
            [23] => tftp
            [24] => ws
            [25] => wss
        )

    [ares] => 
    [ares_num] => 0
    [libidn] => 2.2.0
    [iconv_ver_num] => 0
    [libssh_version] => libssh2/1.11.1
    [brotli_ver_num] => 0
    [brotli_version] => 
)

2 · features

<?

$return = curl_version();

$array =
[
    "CURL_VERSION_IPV6",
    "CURL_VERSION_KERBEROS4",
    "CURL_VERSION_LIBZ",
    "CURL_VERSION_SSL"
];

foreach($array as $value)
{
    if($return["features"] & constant($value))
    {
        echo $value . PHP_EOL
        . " available" . PHP_EOL;
    }
    else
    {
        echo $value . PHP_EOL
        . " not available" . PHP_EOL;
    }
}
CURL_VERSION_IPV6
 available
CURL_VERSION_KERBEROS4
 not available
CURL_VERSION_LIBZ
 available
CURL_VERSION_SSL
 available