wp/wp-includes/class-wp-http.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage HTTP
     6  * @subpackage HTTP
     7  * @since 2.7.0
     7  * @since 2.7.0
     8  */
     8  */
       
     9 
       
    10 // Don't load directly.
       
    11 if ( ! defined( 'ABSPATH' ) ) {
       
    12 	die( '-1' );
       
    13 }
     9 
    14 
    10 if ( ! class_exists( 'WpOrg\Requests\Autoload' ) ) {
    15 if ( ! class_exists( 'WpOrg\Requests\Autoload' ) ) {
    11 	require ABSPATH . WPINC . '/Requests/src/Autoload.php';
    16 	require ABSPATH . WPINC . '/Requests/src/Autoload.php';
    12 
    17 
    13 	WpOrg\Requests\Autoload::register();
    18 	WpOrg\Requests\Autoload::register();
   143 	 *     @type string       $filename            Filename of the file to write to when streaming. $stream must be
   148 	 *     @type string       $filename            Filename of the file to write to when streaming. $stream must be
   144 	 *                                             set to true. Default null.
   149 	 *                                             set to true. Default null.
   145 	 *     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
   150 	 *     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
   146 	 *
   151 	 *
   147 	 * }
   152 	 * }
   148 	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
   153 	 * @return array|WP_Error {
   149 	 *                        A WP_Error instance upon error.
   154 	 *     Array of response data, or a WP_Error instance upon error.
       
   155 	 *
       
   156 	 *     @type \WpOrg\Requests\Utility\CaseInsensitiveDictionary $headers       Response headers keyed by name.
       
   157 	 *     @type string                                            $body          Response body.
       
   158 	 *     @type array                                             $response      {
       
   159 	 *         Array of HTTP response data.
       
   160 	 *
       
   161 	 *         @type int|false    $code    HTTP response status code.
       
   162 	 *         @type string|false $message HTTP response message.
       
   163 	 *     }
       
   164 	 *     @type WP_HTTP_Cookie[]                                  $cookies       Array of cookies set by the server.
       
   165 	 *     @type string|null                                       $filename      Optional. Filename of the response.
       
   166 	 *     @type WP_HTTP_Requests_Response|null                    $http_response Response object.
       
   167 	 * }
   150 	 */
   168 	 */
   151 	public function request( $url, $args = array() ) {
   169 	public function request( $url, $args = array() ) {
   152 		$defaults = array(
   170 		$defaults = array(
   153 			'method'              => 'GET',
   171 			'method'              => 'GET',
   154 			/**
   172 			/**