On this page
WP_Http::post( string $url, string|array $args = array() ): array|WP_Error
Uses the POST HTTP method.
Description
Used for sending data that is expected to be in the body.
Parameters
$urlstring Required-
The request URL.
$argsstring|array Optional-
Override the defaults.
Default:
array()
Return
array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
A WP_Error instance upon error.
Source
File: wp-includes/class-wp-http.php. View all references
public function post( $url, $args = array() ) {
$defaults = array( 'method' => 'POST' );
$parsed_args = wp_parse_args( $args, $defaults );
return $this->request( $url, $parsed_args );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Http::request() wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| wp_parse_args() wp-includes/functions.php | Merges user defined arguments into defaults array. |
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http/post