WpOrg\Requests\Utility

InputValidator::is_curl_handle()public staticWP 1.0

Verify whether a received input parameter is a Curl handle.

The PHP Curl extension worked with resources prior to PHP 8.0 and with an instance of the CurlHandle class since PHP 8.0. https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object

Method of the class: InputValidator{}

No Hooks.

Return

true|false.

Usage

$result = InputValidator::is_curl_handle( $input );
$input(mixed) (required)
Input parameter to verify.

InputValidator::is_curl_handle() code WP 6.6.2

public static function is_curl_handle($input) {
	if (is_resource($input)) {
		return get_resource_type($input) === 'curl';
	}

	if (is_object($input)) {
		return $input instanceof CurlHandle;
	}

	return false;
}