| 116 | * Retrieve the raw response from a safe HTTP request using the PUT method. |
| 117 | * |
| 118 | * This function is ideal when the HTTP request is being made to an arbitrary |
| 119 | * URL. The URL is validated to avoid redirection and request forgery attacks. |
| 120 | * |
| 121 | * @since 3.6.0 |
| 122 | * |
| 123 | * @see wp_remote_request() For more information on the response array format. |
| 124 | * @see WP_Http::request() For default arguments information. |
| 125 | * |
| 126 | * @param string $url Site URL to retrieve. |
| 127 | * @param array $args Optional. Request arguments. Default empty array. |
| 128 | * @return WP_Error|array The response or WP_Error on failure. |
| 129 | */ |
| 130 | function wp_safe_remote_put( $url, $args = array() ) { |
| 131 | $args['reject_unsafe_urls'] = true; |
| 132 | $http = _wp_http_get_object(); |
| 133 | return $http->put( $url, $args ); |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Retrieve the raw response from a safe HTTP request using the DELETE method. |
| 138 | * |
| 139 | * This function is ideal when the HTTP request is being made to an arbitrary |
| 140 | * URL. The URL is validated to avoid redirection and request forgery attacks. |
| 141 | * |
| 142 | * @since 3.6.0 |
| 143 | * |
| 144 | * @see wp_remote_request() For more information on the response array format. |
| 145 | * @see WP_Http::request() For default arguments information. |
| 146 | * |
| 147 | * @param string $url Site URL to retrieve. |
| 148 | * @param array $args Optional. Request arguments. Default empty array. |
| 149 | * @return WP_Error|array The response or WP_Error on failure. |
| 150 | */ |
| 151 | function wp_safe_remote_delete( $url, $args = array() ) { |
| 152 | $args['reject_unsafe_urls'] = true; |
| 153 | $http = _wp_http_get_object(); |
| 154 | return $http->delete( $url, $args ); |
| 155 | } |
| 156 | |
| 157 | /** |
| 252 | * Retrieve the raw response from the HTTP request using the PUT method. |
| 253 | * |
| 254 | * @since 2.7.0 |
| 255 | * |
| 256 | * @see wp_remote_request() For more information on the response array format. |
| 257 | * @see WP_Http::request() For default arguments information. |
| 258 | * |
| 259 | * @param string $url Site URL to retrieve. |
| 260 | * @param array $args Optional. Request arguments. Default empty array. |
| 261 | * @return WP_Error|array The response or WP_Error on failure. |
| 262 | */ |
| 263 | function wp_remote_put( $url, $args = array() ) { |
| 264 | $http = _wp_http_get_object(); |
| 265 | return $http->put( $url, $args ); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Retrieve the raw response from the HTTP request using the DELETE method. |
| 270 | * |
| 271 | * @since 2.7.0 |
| 272 | * |
| 273 | * @see wp_remote_request() For more information on the response array format. |
| 274 | * @see WP_Http::request() For default arguments information. |
| 275 | * |
| 276 | * @param string $url Site URL to retrieve. |
| 277 | * @param array $args Optional. Request arguments. Default empty array. |
| 278 | * @return WP_Error|array The response or WP_Error on failure. |
| 279 | */ |
| 280 | function wp_remote_delete( $url, $args = array() ) { |
| 281 | $http = _wp_http_get_object(); |
| 282 | return $http->delete( $url, $args ); |
| 283 | } |
| 284 | |
| 285 | /** |