Requests_IRI::set_port() WordPress Method

The Requests_IRI::set_port() method is used to set the port number for an IRI. This is useful when making requests to a URL that uses a non-standard port number.

Requests_IRI::set_port( string $port ) #

Set the port. Returns true on success, false on failure (if there are any invalid characters).


Parameters

$port

(string)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/Requests/IRI.php

	protected function set_port($port) {
		if ($port === null) {
			$this->port = null;
			return true;
		}

		if (strspn($port, '0123456789') === strlen($port)) {
			$this->port = (int) $port;
			$this->scheme_normalization();
			return true;
		}

		$this->port = null;
		return false;
	}

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.