Changeset 29230 for trunk/src/wp-includes/class-http.php
- Timestamp:
- 07/18/2014 10:00:51 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-http.php
r29229 r29230 29 29 30 30 /** 31 * Send a HTTP request to a URI. 32 * 33 * The body and headers are part of the arguments. The 'body' argument is for the body and will 34 * accept either a string or an array. The 'headers' argument should be an array, but a string 35 * is acceptable. If the 'body' argument is an array, then it will automatically be escaped 36 * using http_build_query(). 37 * 38 * The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS 39 * protocols. 40 * 41 * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and 42 * 'user-agent'. 43 * 44 * Accepted 'method' values are 'GET', 'POST', and 'HEAD', some transports technically allow 45 * others, but should not be assumed. The 'timeout' is used to sent how long the connection 46 * should stay open before failing when no response. 'redirection' is used to track how many 47 * redirects were taken and used to sent the amount for other transports, but not all transports 48 * accept setting that value. 49 * 50 * The 'httpversion' option is used to sent the HTTP version and accepted values are '1.0', and 51 * '1.1' and should be a string. The 'user-agent' option is the user-agent and is used to 52 * replace the default user-agent, which is 'WordPress/WP_Version', where WP_Version is the 53 * value from $wp_version. 54 * 55 * The 'blocking' parameter can be used to specify if the calling code requires the result of 56 * the HTTP request. If set to false, the request will be sent to the remote server, and 57 * processing returned to the calling code immediately, the caller will know if the request 58 * suceeded or failed, but will not receive any response from the remote server. 31 * Send an HTTP request to a URI. 32 * 33 * Please note: The only URI that are supported in the HTTP Transport implementation 34 * are the HTTP and HTTPS protocols. 59 35 * 60 36 * @access public 61 37 * @since 2.7.0 62 38 * 63 * @param string $url The request URL. 64 * @param string|array $args Optional. Override the defaults. 65 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error 39 * @param string $url The request URL. 40 * @param string|array $args { 41 * Optional. Array or string of HTTP request arguments. 42 * 43 * @type string $method Request method. Accepts 'GET', 'POST', 'HEAD', or 'PUT'. 44 * Some transports technically allow others, but should not be 45 * assumed. Default 'GET'. 46 * @type int $timeout How long the connection should stay open in seconds. Default 5. 47 * @type int $redirection Number of allowed redirects. Not supported by all transports 48 * Default 5. 49 * @type string $httpversion Version of the HTTP protocol to use. Accepts '1.0' and '1.1'. 50 * Default '1.0'. 51 * @type string $user-agent User-agent value sent. 52 * Default WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ). 53 * @type bool $reject_unsafe_urls Whether to pass URLs through {@see wp_http_validate_url()}. 54 * Default false. 55 * @type bool $blocking Whether the calling code requires the result of the request. 56 * If set to false, the request will be sent to the remote server, 57 * and processing returned to the calling code immediately, the caller 58 * will know if the request succeeded or failed, but will not receive 59 * any response from the remote server. Default true. 60 * @type string|array $headers Array or string of headers to send with the request. 61 * Default empty array. 62 * @type array $cookies List of cookies to send with the request. Default empty array. 63 * @type string|array $body Body to send with the request. Default null. 64 * @type bool $compress Whether to compress the $body when sending the request. 65 * Default false. 66 * @type bool $decompress Whether to decompress a compressed response. If set to false and 67 * compressed content is returned in the response anyway, it will 68 * need to be separately decompressed. Default true. 69 * @type bool $sslverify Whether to verify SSL for the request. Default true. 70 * @type string sslcertificates Absolute path to an SSL certificate .crt file. 71 * Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'. 72 * @type bool $stream Whether to stream to a file. If set to true and no filename was 73 * given, it will be droped it in the WP temp dir and its name will 74 * be set using the basename of the URL. Default false. 75 * @type string $filename Filename of the file to write to when streaming. $stream must be 76 * set to true. Default null. 77 * @type int $limit_response_size Size in bytes to limit the response to. Default null. 78 * 79 * } 80 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. 81 * A WP_Error instance upon error. 66 82 */ 67 83 public function request( $url, $args = array() ) {
Note: See TracChangeset
for help on using the changeset viewer.