wp_remote_retrieve_cookies

Retrieve only the cookies from the raw response.

Description

(array) wp_remote_retrieve_cookies( (array) $response ); 

Returns (array)

An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.

Parameters (1)

0. $response (array)
HTTP response.

Usage

  1. if ( !function_exists( 'wp_remote_retrieve_cookies' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4. // HTTP response. 
  5. $response = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_remote_retrieve_cookies($response); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/http.php  
  1. function wp_remote_retrieve_cookies( $response ) { 
  2. if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { 
  3. return array(); 
  4.  
  5. return $response['cookies'];