wp_remote_post

函式
wp_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_safe_remote_postwp_remote_getwp_write_postwp_delete_postwp_remote_request
引入
2.7.0
棄用
-

wp_remote_post是一個WordPress函式,用於向遠端伺服器發出HTTP POST請求。它類似於wp_remote_get,但有額外的引數,允許你指定要在請求體中傳送的資料、內容型別和其他HTTP請求的細節。

使用POST方法執行一個HTTP請求並返回其響應。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_remote_post( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->post( $url, $args );
}
function wp_remote_post( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->post( $url, $args ); }
function wp_remote_post( $url, $args = array() ) {
	$http = _wp_http_get_object();
	return $http->post( $url, $args );
}

常見問題

FAQs
檢視更多 >