Requests_Proxy_HTTP::__construct() WordPress Method

The Requests_Proxy_HTTP::__construct() method is used to establish an HTTP proxy connection. This method accepts an array of options that can be used to set the proxy server, port, and authentication credentials, if necessary.

Requests_Proxy_HTTP::__construct( array|null $args = null ) #

Constructor


Parameters

$args

(array|null)(Optional)Array of user and password. Must have exactly two elements

Default value: null


Top ↑

Source

File: wp-includes/Requests/Proxy/HTTP.php

	public function __construct($args = null) {
		if (is_string($args)) {
			$this->proxy = $args;
		}
		elseif (is_array($args)) {
			if (count($args) === 1) {
				list($this->proxy) = $args;
			}
			elseif (count($args) === 3) {
				list($this->proxy, $this->user, $this->pass) = $args;
				$this->use_authentication                    = true;
			}
			else {
				throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs');
			}
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
1.6Introduced.

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.