Duke Yin's Technology database

wp_remote_get $args

wp_remote_get( $url, $args = array() )

* @param string|array $args {
*     Optional. Array or string of HTTP request arguments.
*     @type string       $method              Request method. Accepts 'GET', 'POST', 'HEAD', 'PUT', 'DELETE',
*                                             'TRACE', 'OPTIONS', or 'PATCH'.
*                                             Some transports technically allow others, but should not be
*                                             assumed. Default 'GET'.
*     @type float        $timeout             How long the connection should stay open in seconds. Default 5.
*     @type int          $redirection         Number of allowed redirects. Not supported by all transports
*                                             Default 5.
*     @type string       $httpversion         Version of the HTTP protocol to use. Accepts '1.0' and '1.1'.
*                                             Default '1.0'.
*     @type string       $user-agent          User-agent value sent.
*                                             Default 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ).
*     @type bool         $reject_unsafe_urls  Whether to pass URLs through wp_http_validate_url().
*                                             Default false.
*     @type bool         $blocking            Whether the calling code requires the result of the request.
*                                             If set to false, the request will be sent to the remote server,
*                                             and processing returned to the calling code immediately, the caller
*                                             will know if the request succeeded or failed, but will not receive
*                                             any response from the remote server. Default true.
*     @type string|array $headers             Array or string of headers to send with the request.
*                                             Default empty array.
*     @type array        $cookies             List of cookies to send with the request. Default empty array.
*     @type string|array $body                Body to send with the request. Default null.
*     @type bool         $compress            Whether to compress the $body when sending the request.
*                                             Default false.
*     @type bool         $decompress          Whether to decompress a compressed response. If set to false and
*                                             compressed content is returned in the response anyway, it will
*                                             need to be separately decompressed. Default true.
*     @type bool         $sslverify           Whether to verify SSL for the request. Default true.
*     @type string       $sslcertificates     Absolute path to an SSL certificate .crt file.
*                                             Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
*     @type bool         $stream              Whether to stream to a file. If set to true and no filename was
*                                             given, it will be droped it in the WP temp dir and its name will
*                                             be set using the basename of the URL. Default false.
*     @type string       $filename            Filename of the file to write to when streaming. $stream must be
*                                             set to true. Default null.
*     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
* }



标注 * 的为必填项。