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:
| Key | Value |
|---|---|
| version_number | cURL 24 bit version number |
| version | cURL version number, as a string |
| ssl_version_number | OpenSSL 24 bit version number |
| ssl_version | OpenSSL version number, as a string |
| libz_version | zlib version number, as a string |
| host | Information about the host where cURL was built |
| age | |
| features | A bitmask of the CURL_VERSION_* constants |
| protocols | An array of protocols names supported by cURL |
| feature_list | An 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] => 529152
[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.19.0
[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] => mqtts
[14] => pop3
[15] => pop3s
[16] => rtsp
[17] => scp
[18] => sftp
[19] => smb
[20] => smbs
[21] => smtp
[22] => smtps
[23] => telnet
[24] => tftp
[25] => ws
[26] => 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
Links
cURL
- curl_close
- curl_copy_handle
- curl_errno
- curl_error
- curl_escape
- curl_exec
- curl_getinfo
- curl_init
- curl_multi_add_handle
- curl_multi_close
- curl_multi_errno
- curl_multi_exec
- curl_multi_getcontent
- curl_multi_info_read
- curl_multi_init
- curl_multi_remove_handle
- curl_multi_select
- curl_multi_setopt
- curl_multi_strerror
- curl_pause
- curl_reset
- curl_setopt
- curl_setopt_array
- curl_share_close
- curl_share_errno
- curl_share_init
- curl_share_init_persistent
- curl_share_setopt
- curl_share_strerror
- curl_strerror
- curl_unescape
- curl_upkeep