W3cubDocs

/WordPress

WP_Http::get( string $url, string|array $args = array() ): array|WP_Error

Uses the GET HTTP method.

Description

Used for sending data that is expected to be in the body.

Parameters

$urlstringrequired
The request URL.
$argsstring|arrayoptional
Override the defaults.

Default:array()

Return

array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
A WP_Error instance upon error. See WP_Http::response() for details.

Source

public function get( $url, $args = array() ) {
	$defaults    = array( 'method' => 'GET' );
	$parsed_args = wp_parse_args( $args, $defaults );
	return $this->request( $url, $parsed_args );
}

Changelog

Version Description
2.7.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http/get