WordPressMaking network requests with HTTP API


Syntax

  • $response = wp_remote_get( $url, $args );
  • $response = wp_remote_post( $url, $args );
  • $response = wp_safe_remote_post( $url, $args );

Parameters

ParameterDetails
$url(string) (Required) Site URL to retrieve.
$args(array) (Optional) Request arguments.

Remarks

Returns

(WP_Error | array) The response as an array, or WP_Error on failure.