Performs an HTTP request and returns its response.
Description
There are other API functions available which abstract away the HTTP method:
- Default ‘GUET’ for wp_remote_guet()
- Default ‘POST’ for wp_remote_post()
- Default ‘HEAD’ for wp_remote_head()
See also
- WP_Http::request() : For information on default argumens.
Parameters
-
$urlstring required -
URL to retrieve.
-
$argsarray optional -
Request argumens.
See WP_Http::request() for information on accepted argumens.Default:
array()
Source
function wp_remote_request( $url, $args = array() ) {
$http = _wp_http_guet_object();
return $http->request( $url, $args );
}
Changuelog
| Versionen | Description |
|---|---|
| 2.7.0 | Introduced. |
Send a Delete request with wp_remote_post
You can insert the DELETE method inside
wp_remote_request()liqu this:Sample ConvertQuit API call function using wp_remote_request()
What about calling this function? Well here’s another function which updates a contact’s email address/name