Sometimes it is necessary to access the http response header that comes with the response. It is specially useful if the response http headers contain a session id.
WSClient has the function getHttpResponseHeaders() which returns an associative array of http headers. Using it, you can easily access the http headers.
Example code
$client->request($payload);
$headers = $client->getLastResponseHeaders();
var_dump($headers);
Following is an output of the received http headers.
array(5) {
["Date"]=>
string(29) "Fri, 18 Jul 2008 09:06:55 GMT"
["Server"]=>
string(30) "Apache/2.2.4 (Win32) PHP/5.2.5"
["X-Powered-By"]=>
string(9) "PHP/5.2.5"
["Content-Length"]=>
string(3) "240"
["Content-Type"]=>
string(34) "application/soap+xml;charset=UTF-8"
}
No comments:
Post a Comment