WpOrg\Requests\Transport
Fsockopen::test
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() Fsockopen::test code WP 7.0
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;
}