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

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

Usage and examples of PHP curl_version() function

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
versionCURL version number, string format
ssl_version_numberOpenSSL 24 Bit version number
ssl_versionOpenSSL version number, string format
libz_versionzlib version number, string format
hostInformation about the compilation host of CURL
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 CURL version array
$version = curl_version();
// Use bitfields in the CURL compilation version to check 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