Reading Set-Cookie Instructions in the HTTP Response Header

Are there any standard tools in PHP for reading instructions Set-Cookiein the header of an HTTP response, without manually analyzing it?

In particular, I want to read the cookie value ASP.NET_SessionIdreturned by the ASP.NET web service that I consume.


EDIT:

I am using a web service using my own PHP class SoapClient. I can use the method __getLastResponseHeaders()to retrieve the entire HTTP response header returned by the web service:

HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=ku501l55o300ik3sa2gu3vzj; path=/; HttpOnly
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Tue, 11 Jan 2011 23:34:02 GMT
Content-Length: 368

But I want to extract the ASP.NET_SessionIdcookie value :

ku501l55o300ik3sa2gu3vzj

And, of course, I do not want to do this manually.

+1
source share
2 answers

cookie, , :

var_dump ($ → _ );

echo "cookie is". $client → _ cookies [ "ASP.NET_SessionId" ] [0];

+1

:

$_COOKIE['ASP.NET_SessionId'];

:

$cookies = getCookies();
$sessionId = $cookies['ASP.NET_SessionId'];

, - , :

print_r($cookies);

, -.

+2

All Articles