wp_safe_remote_post

函数


wp_safe_remote_post ( $url, $args = array() )
参数
  • (string)
    $url
    URL to retrieve.
    Required:
  • (array)
    $args
    Optional. Request arguments. Default empty array.
    Required:
    Default: array()
返回值
  • (array|WP_Error) The response or WP_Error on failure.
相关
  • wp_remote_request()
  • WP_Http::request()
定义位置
  • wp-includes/http.php
    , line 86
引入
3.6.0
弃用

检索使用POST方法的安全HTTP请求的原始响应。

当HTTP请求被发送到一个任意的URL时,这个函数是理想的。该URL被验证以避免重定向和请求伪造攻击。

function wp_safe_remote_post( $url, $args = array() ) {
	$args['reject_unsafe_urls'] = true;
	$http                       = _wp_http_get_object();
	return $http->post( $url, $args );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。