English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP curl_version() Function Usage and Example

PHP CURL Reference Manual

(PHP 5 >= 5.5.0)

curl_version — Get CURL version information.

Syntax

array curl_version ([ int $age = CURLVERSION_NOW ] )

Returns version information about CURL.

Parameter

age

Return Value

Returns an array related to the following elements:

IndexValue Description
version_numberCURL 24Bit version number
versionVersion number of CURL, in string format
ssl_version_numberOpenSSL 24 Bit version number
ssl_versionVersion number of OpenSSL, in string format
libz_versionVersion number of zlib, in string format
hostInformation about the host where CURL is compiled
age 
featuresOneCURL_VERSION_XXXBitmask of constants
protocolsAn array of protocol names supported by CURL

Online Example

This example will check which features are available in the 'features' bitmask returned by curl_version() for the current CURL version.

<?php
// Get the CURL version array
$version = curl_version();
// Use bitfields in the CURL compilation version to check for certain features
$bitfields = Array(
            'CURL_VERSION_IPV'6', 
            'CURL_VERSION_KERBEROS'4', 
            'CURL_VERSION_SSL', 
            'CURL_VERSION_LIBZ'
            );
foreach($bitfields as $feature)
{
    echo $feature . ($version['features'] & constant($feature) ? ' matches' : ' does not match');
    echo PHP_EOL;
}
?>

PHP CURL Reference Manual