Reading the Set-Cookie instructions in an HTTP Response header

Posted by Eduardo León on Stack Overflow See other posts from Stack Overflow or by Eduardo León
Published on 2011-01-11T23:19:03Z Indexed on 2011/01/11 23:53 UTC
Read the original article Hit count: 232

Filed under:
|
|

Is there any standard means in PHP to read the Set-Cookie instructions in an HTTP Response header, without manually parsing it?

More specifically, I want to read the value of the ASP.NET_SessionId cookie returned by an ASP.NET Web Service I am consuming.


EDIT:

I am consuming the Web Service using PHP's native SoapClient class. I can use the __getLastResponseHeaders() method to retrieve the whole of the 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 value of the ASP.NET_SessionID cookie:

ku501l55o300ik3sa2gu3vzj

And, of course, I don't want to do it manually.

© Stack Overflow or respective owner

Related posts about php

Related posts about http