WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp remote retrieve response code

Description

Retrieve only the response code from the raw response.

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

Usage

 <?php wp_remote_retrieve_response_code$response ); ?> 

Parameters

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

Return Values

(integer) 
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