Fsockopen::test( $capabilities = array() )

Self-test whether the transport can be used.


Description

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


Parameters

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


Return

(bool) Whether the transport can be used.


Source

File: wp-includes/Requests/src/Transport/Fsockopen.php

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