从HTTP请求中检索原始响应。
原型
wp_remote_request( string $url, array $args = array() )
描述
数组结构有点复杂:
参考:
- wp_remote_get()
- wp_remote_post()
- wp_remote_head()
参数
$url
(string)
(Required)
要检索的网站网址。
$args
(array)
(Optional)
请求参数。
返回值
(WP_Error|array)
回应或
源文件
路径:wp-includes/http.php
<?php
...
function wp_remote_request($url, $args = array()) {
$http = _wp_http_get_object();
return $http->request( $url, $args );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_remote_request/