WpOrg\Requests\Transport

Curl::test()public staticWP 1.0

Self-test whether the transport can be used.

The available capabilities to test for can be found in Capability{}.

Method of the class: Curl{}

No Hooks.

Return

true|false. Whether the transport can be used.

Usage

$result = Curl::test( $capabilities );
$capabilities **
-
Default: []

Curl::test() code WP 6.6.2

public static function test($capabilities = []) {
	if (!function_exists('curl_init') || !function_exists('curl_exec')) {
		return false;
	}

	// If needed, check that our installed curl version supports SSL
	if (isset($capabilities[Capability::SSL]) && $capabilities[Capability::SSL]) {
		$curl_version = curl_version();
		if (!(CURL_VERSION_SSL & $curl_version['features'])) {
			return false;
		}
	}

	return true;
}