- Patch #950662 by amateescu: documentation improvements for drupal_http_request()

merge-requests/26/head
Dries Buytaert 2010-10-26 15:17:50 +00:00
parent 7b1fc6d495
commit c705279a7a
1 changed files with 29 additions and 40 deletions

View File

@ -726,46 +726,35 @@ function drupal_access_denied() {
* *
* @param $url * @param $url
* A string containing a fully qualified URI. * A string containing a fully qualified URI.
* @param $options * @param array $options
* (optional) An array which can have one or more of following keys: * (optional) An array that can have one or more of the following elements:
* - headers * - headers: An array containing request headers to send as name/value pairs.
* An array containing request headers to send as name/value pairs. * - method: A string containing the request method. Defaults to 'GET'.
* - method * - data: A string containing the request body, formatted as
* A string containing the request method. Defaults to 'GET'. * 'param=value&param=value&...'. Defaults to NULL.
* - data * - max_redirects: An integer representing how many times a redirect
* A string containing the request body. Defaults to NULL. * may be followed. Defaults to 3.
* - max_redirects * - timeout: A float representing the maximum number of seconds the function
* An integer representing how many times a redirect may be followed. * call may take. The default is 30 seconds. If a timeout occurs, the error
* Defaults to 3. * code is set to the HTTP_REQUEST_TIMEOUT constant.
* - timeout * - context: A context resource created with stream_context_create().
* A float representing the maximum number of seconds the function call *
* may take. The default is 30 seconds. If a timeout occurs, the error * @return object
* code is set to the HTTP_REQUEST_TIMEOUT constant. * An object that can have one or more of the following components:
* - context * - request: A string containing the request body that was sent.
* A context resource created with stream_context_create(). * - code: An integer containing the response status code, or the error code
* @return * if an error occurred.
* An object which can have one or more of the following parameters: * - protocol: The response protocol (e.g. HTTP/1.1 or HTTP/1.0).
* - request * - status_message: The status message from the response, if a response was
* A string containing the request body that was sent. * received.
* - code * - redirect_code: If redirected, an integer containing the initial response
* An integer containing the response status code, or the error code if * status code.
* an error occurred. * - redirect_url: If redirected, a string containing the redirection location.
* - protocol * - error: If an error occurred, the error message. Otherwise not set.
* The response protocol (e.g. HTTP/1.1 or HTTP/1.0). * - headers: An array containing the response headers as name/value pairs.
* - status_message * HTTP header names are case-insensitive (RFC 2616, section 4.2), so for
* The status message from the response, if a response was received. * easy access the array keys are returned in lower case.
* - redirect_code * - data: A string containing the response body that was received.
* If redirected, an integer containing the initial response status code.
* - redirect_url
* If redirected, a string containing the redirection location.
* - error
* If an error occurred, the error message. Otherwise not set.
* - headers
* An array containing the response headers as name/value pairs. HTTP
* header names are case-insensitive (RFC 2616, section 4.2), so for easy
* access the array keys are returned in lower case.
* - data
* A string containing the response body that was received.
*/ */
function drupal_http_request($url, array $options = array()) { function drupal_http_request($url, array $options = array()) {
$result = new stdClass(); $result = new stdClass();