PHP Retrieve Cookie which was not set with setcookie
I have the following problem - a third party software is setting a cookie with the login credentials and then forward the user to my app. I now need to retrieve the cookie values:
The problem is - I can do this easily in the Frontend/AS3 with
var ticket : String = CookieUtil.getCookie( 'ticket' ).toString();
but in PHP, the cookie is not within the $_COOKIES array.
The cookie values are:
Name: ticket
Domain: .myserver.com
Path : /
Send for: encrypte开发者_C百科d connections only
Expires: at end of session
The one I see, and set before in PHP, is:
Name: myCookie
Host: myserver.com
Path : /
Send for: any type of connection
Expires: at end of session
Actually, since host/domain are both the same, it should be visible in the PHP script, since it is running on this domain.
Any thoughts? Thankx
Martin
I don't know if this can be useful for you but, the PHP manual (cookie section) states:
Any cookies sent to you from the client will automatically be included into a $_COOKIE auto-global array if variables_order contains "C".
You should check the php config variables_order directive in order to be shure the Cookie flag is set.
ahahah got it! $_COOKIE not $_COOKIES :)
get a habit to program in PHP with error_reporting(E_ALL)
reporting level, to avoid such a silly mistakes
Could this be domain sub domain issue? I mean www.myserver.com is not 'under' .www.myserver.com ... ?
The cookie should have the domain set to ".myserver.com"
Currently the only way to get this cookie is to have a script living under ".www.myserver.com" like "app.www.myserver.com"
EDIT: The OP had a typo. But are cookies with domain "myserver.com" members of ".myserver.com" ?
Any thoughts?
Actually, cookie is not a text file. But merely HTTP header.
So, to see a real cookie, one must watch HTTP interchange log, not the files on the client PC.
I am sure watching HTTP log would bring some light on the situation. It can be dome in many ways, LiveHTTPheaders mozilla addon for example.
Both Cookie
and Set-Cookie
headers are to count.
精彩评论