WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp remote retrieve response code

Contents

Description

Retrieve only the response code from the raw response.

Will return an empty array if incorrect parameter value is given.

Usage

 <?php wp_remote_retrieve_response_code$response ); ?> 

Parameters

$response
(array) (required) HTTP response.
Default: None

Return Values

(string) 
the response code. Empty string on incorrect parameter given.

Examples

$response = wp_remote_get('http://www.foo.com/file.txt');
$response_code = wp_remote_retrieve_response_code( $response );

$response code will contain a string representing the numeric response code sent from the server


Change Log

Since: 2.7.0

Source File

wp_remote_retrieve_response_code() is located in wp-includes/http.php