WP_Http_Streams::test

Advertisement

Summery Summery

Determines whether this class can be used for retrieving a URL.

Syntax Syntax

WP_Http_Streams::test( array $args = array() )

Parameters Parameters

$args

(Optional) Array of request arguments.

Default value: array()

Return Return

(bool) False means this class can not be used, true means it can.

Source Source

File: wp-includes/class-wp-http-streams.php

	 * @return bool False means this class can not be used, true means it can.
	 */
	public static function test( $args = array() ) {
		if ( ! function_exists( 'stream_socket_client' ) ) {
			return false;
		}

		$is_ssl = isset( $args['ssl'] ) && $args['ssl'];

		if ( $is_ssl ) {
			if ( ! extension_loaded( 'openssl' ) ) {
				return false;
			}
			if ( ! function_exists( 'openssl_x509_parse' ) ) {
				return false;
			}
		}

		/**
		 * Filters whether streams can be used as a transport for retrieving a URL.
		 *
		 * @since 2.7.0
		 *
		 * @param bool  $use_class Whether the class can be used. Default true.
		 * @param array $args      Request arguments.
		 */

Advertisement

Changelog Changelog

Changelog
Version Description
3.7.0 Combined with the fsockopen transport and switched to stream_socket_client().
2.7.0 Introduced.

Advertisement

Leave a Reply