Accessing http response headers with WSF/PHP

Friday, July 18, 2008

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


$headers = $client->getLastResponseHeaders();


Following is an output of the received http headers.

array(5) {
  string(29) "Fri, 18 Jul 2008 09:06:55 GMT"
  string(30) "Apache/2.2.4 (Win32) PHP/5.2.5"
  string(9) "PHP/5.2.5"
  string(3) "240"
  string(34) "application/soap+xml;charset=UTF-8"

No comments: