Curl::test( $capabilities = array() ): bool

In this article

Self-test whether the transport can be used.

Description

The available capabilities to test for can be found in \WpOrg\Requests\Capability.

Parameters

bool> $capabilities Optional. Associative array of capabilities to test against, i.e. [<capability> => true].

Return

bool Whether the transport can be used.

Source

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;
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.