WP_HTTP_IXR_Client::__construct() WordPress Method

The WP_HTTP_IXR_Client::__construct() function initializes a new IXR Client object. This function takes two arguments, the first being a string containing the URL of the XML-RPC server to connect to, and the second being an optional array of parameters. The URL argument is required and must be a valid XML-RPC server URL. The array of parameters is optional but can be used to set the following options: * use_ssl - Whether to connect to the XML-RPC server using SSL. Default is false. * timeout - The maximum number of seconds to allow for the XML-RPC server connection. Default is 5. * user_agent - The User-Agent string to send when making XML-RPC server requests. Default is 'WordPress/{version}'. Once the WP_HTTP_IXR_Client object is initialized, you can then use its various methods to make XML-RPC calls to the server.

WP_HTTP_IXR_Client::__construct( string $server, string|false $path = false, int|false $port = false, int $timeout = 15 ) #


Parameters

$server

(string)(Required)

$path

(string|false)(Optional)

Default value: false

$port

(int|false)(Optional)

Default value: false

$timeout

(int)(Optional)

Default value: 15


Top ↑

Source

File: wp-includes/class-wp-http-ixr-client.php

	public function __construct( $server, $path = false, $port = false, $timeout = 15 ) {
		if ( ! $path ) {
			// Assume we have been given a URL instead.
			$bits         = parse_url( $server );
			$this->scheme = $bits['scheme'];
			$this->server = $bits['host'];
			$this->port   = isset( $bits['port'] ) ? $bits['port'] : $port;
			$this->path   = ! empty( $bits['path'] ) ? $bits['path'] : '/';

			// Make absolutely sure we have a path.
			if ( ! $this->path ) {
				$this->path = '/';
			}

			if ( ! empty( $bits['query'] ) ) {
				$this->path .= '?' . $bits['query'];
			}
		} else {
			$this->scheme = 'http';
			$this->server = $server;
			$this->path   = $path;
			$this->port   = $port;
		}
		$this->useragent = 'The Incutio XML-RPC PHP Library';
		$this->timeout   = $timeout;
	}

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.