Requests_Transport_fsockopen::test() WordPress Method

The Wordpress method, Requests_Transport_fsockopen::test(), is used to check if a given URL can be accessed using the fsockopen() function. This is a useful function for debugging purposes, as it can be used to determine if a given URL is accessible from the server on which the code is running.

Requests_Transport_fsockopen::test( $capabilities = array() ) #

Whether this transport is valid

Contents


Return

(boolean) True if the transport is valid, false otherwise.


Top ↑

Source

File: wp-includes/Requests/Transport/fsockopen.php

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

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

			// Currently broken, thanks to https://github.com/facebook/hhvm/issues/2156
			if (defined('HHVM_VERSION')) {
				return false;
			}
		}

		return true;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.