WpOrg\Requests\Transport

Fsockopen::testpublic 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: Fsockopen{}

No Hooks.

Returns

true|false. Whether the transport can be used.

Usage

$result = Fsockopen::test( $capabilities );
$capabilities
.
Default: []

Fsockopen::test() code WP 6.8.1

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

	// If needed, check that streams support SSL
	if (isset($capabilities[Capability::SSL]) && $capabilities[Capability::SSL]) {
		if (!extension_loaded('openssl') || !function_exists('openssl_x509_parse')) {
			return false;
		}
	}

	return true;
}