class Requests {}

In this article

This class has been deprecated. Use WpOrgRequestsRequests instead for the actual functionality and use WpOrgRequestsAutoload for the autoloading.

Requests for PHP

Description

Inspired by Requests for Python.

Based on concepts from SimplePie_File, RequestCore and WP_Http.

Methods

NameDescription
Requests::__constructThis is a static class, do not instantiate it
Requests::add_transportRegister a transport
Requests::autoloaderDeprecated autoloader for Requests. — deprecated
Requests::compatible_gzinflateDecompression of deflated string while staying compatible with the majority of servers.
Requests::decode_chunkedDecoded a chunked body as per RFC 2616
Requests::decompressDecompress an encoded body
Requests::deleteSend a DELETE request
Requests::flattenConvert a key => value array to a ‘key: value’ array for headers
Requests::flatternConvert a key => value array to a ‘key: value’ array for headers — deprecated
Requests::getSend a GET request
Requests::get_certificate_pathGet default certificate path.
Requests::get_default_optionsGet the default options
Requests::get_transportGet a working transport
Requests::headSend a HEAD request
Requests::match_domain
Requests::optionsSend an OPTIONS request
Requests::parse_multipleCallback for `transport.internal.parse_response`
Requests::parse_responseHTTP response parser
Requests::patchSend a PATCH request
Requests::postSend a POST request
Requests::putSend a PUT request
Requests::register_autoloaderRegister the built-in autoloader — deprecated
Requests::requestMain interface for HTTP requests
Requests::request_multipleSend multiple HTTP requests simultaneously
Requests::set_certificate_pathSet default certificate path.
Requests::set_defaultsSet the default values
Requests::traceSend a TRACE request

Source

class Requests extends WpOrg\Requests\Requests {

	/**
	 * Deprecated autoloader for Requests.
	 *
	 * @deprecated 6.2.0 Use the `WpOrg\Requests\Autoload::load()` method instead.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $class Class name to load
	 */
	public static function autoloader($class) {
		if (class_exists('WpOrg\Requests\Autoload') === false) {
			require_once __DIR__ . '/Requests/src/Autoload.php';
		}

		return WpOrg\Requests\Autoload::load($class);
	}

	/**
	 * Register the built-in autoloader
	 *
	 * @deprecated 6.2.0 Include the `WpOrg\Requests\Autoload` class and
	 *                   call `WpOrg\Requests\Autoload::register()` instead.
	 *
	 * @codeCoverageIgnore
	 */
	public static function register_autoloader() {
		require_once __DIR__ . '/Requests/src/Autoload.php';
		WpOrg\Requests\Autoload::register();
	}
}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.