DrewM\MailChimp\MailChimp::getLastResponse PHP Method

getLastResponse() public method

Get an array containing the HTTP headers and the body of the API response.
public getLastResponse ( ) : array
return array Assoc array with keys 'headers' and 'body'
    public function getLastResponse()
    {
        return $this->last_response;
    }

Usage Example

 /**
  * Handles responses from the MailChimp API.
  *
  * @param MailChimp $mailChimp
  * @return Array
  */
 public function handleMailChimpResponse($mailChimp)
 {
     $response = $mailChimp->getLastResponse();
     if (!$mailChimp->success()) {
         $message = $response && array_key_exists($response['errors']) ? $response['errors'][0]['message'] : 'Error connecting to MailChimp API';
         user_error($message, E_USER_ERROR);
     }
     return Convert::json2array($response['body']);
 }
All Usage Examples Of DrewM\MailChimp\MailChimp::getLastResponse