/wp-includes/http.php

Description

Simple and uniform HTTP request API.

Will eventually replace and standardize the WordPress HTTP requests made.

Classes
Class Description
WP_Http WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
WP_Http_Fsockopen HTTP request method uses fsockopen function to retrieve the url.
WP_Http_Fopen HTTP request method uses fopen function to retrieve the url.
WP_Http_Streams HTTP request method uses Streams to retrieve the url.
WP_Http_ExtHTTP HTTP request method uses HTTP extension to retrieve the url.
WP_Http_Curl HTTP request method uses Curl extension to retrieve the url.
WP_HTTP_Proxy Adds Proxy support to the WordPress HTTP API.
WP_Http_Cookie Internal representation of a single cookie.
WP_Http_Encoding Implementation for deflate and gzip transfer encodings.
Functions
wp_remote_get (line 1998)

Retrieve the raw response from the HTTP request using the GET method.

  • return: The response or WP_Error on failure.
  • see: wp_remote_request() For more information on the response array format.
  • since: 2.7.0
  • usedby: wp_remote_fopen()
WP_Error|array wp_remote_get (string $url, [array $args = array()])
  • string $url: Site URL to retrieve.
  • array $args: Optional. Override the defaults.
wp_remote_head (line 2030)

Retrieve the raw response from the HTTP request using the HEAD method.

  • return: The response or WP_Error on failure.
  • see: wp_remote_request() For more information on the response array format.
  • since: 2.7.0
WP_Error|array wp_remote_head (string $url, [array $args = array()])
  • string $url: Site URL to retrieve.
  • array $args: Optional. Override the defaults.
wp_remote_post (line 2014)

Retrieve the raw response from the HTTP request using the POST method.

  • return: The response or WP_Error on failure.
  • see: wp_remote_request() For more information on the response array format.
  • since: 2.7.0
WP_Error|array wp_remote_post (string $url, [array $args = array()])
  • string $url: Site URL to retrieve.
  • array $args: Optional. Override the defaults.
wp_remote_request (line 1982)

Retrieve the raw response from the HTTP request.

The array structure is a little complex.

  1.  $res array'headers' => array()'response' => array('code' => int'message' => string) );

All of the headers in $res['headers'] are with the name as the key and the value as the value. So to get the User-Agent, you would do the following.

  1.  $user_agent $res['headers']['user-agent'];

The body is the raw response content and can be retrieved from $res['body'].

This function is called first to make the request and there are other API functions to abstract out the above convoluted setup.

  • return: The response or WP_Error on failure.
  • since: 2.7.0
WP_Error|array wp_remote_request (string $url, [array $args = array()])
  • string $url: Site URL to retrieve.
  • array $args: Optional. Override the defaults.
wp_remote_retrieve_body (line 2111)

Retrieve only the body from the raw response.

  • return: The body of the response. Empty string if no body or incorrect parameter given.
  • since: 2.7.0
string wp_remote_retrieve_body ( &$response, array $response)
  • array $response: HTTP response.
  • &$response
wp_remote_retrieve_header (line 2059)

Retrieve a single header by name from the raw response.

  • return: The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.
  • since: 2.7.0
string wp_remote_retrieve_header ( &$response, string $header, array $response)
  • array $response
  • string $header: Header name to retrieve value from.
  • &$response
wp_remote_retrieve_headers (line 2043)

Retrieve only the headers from the raw response.

  • return: The headers of the response. Empty array if incorrect parameter given.
  • since: 2.7.0
array wp_remote_retrieve_headers ( &$response, array $response)
  • array $response: HTTP response.
  • &$response
wp_remote_retrieve_response_code (line 2079)

Retrieve only the response code from the raw response.

Will return an empty array if incorrect parameter value is given.

  • return: the response code. Empty string on incorrect parameter given.
  • since: 2.7.0
string wp_remote_retrieve_response_code ( &$response, array $response)
  • array $response: HTTP response.
  • &$response
wp_remote_retrieve_response_message (line 2096)

Retrieve only the response message from the raw response.

Will return an empty array if incorrect parameter value is given.

  • return: The response message. Empty string on incorrect parameter given.
  • since: 2.7.0
string wp_remote_retrieve_response_message ( &$response, array $response)
  • array $response: HTTP response.
  • &$response

Documentation generated on Wed, 25 Nov 2009 23:16:16 +0000 by phpDocumentor 1.4.1