简体   繁体   中英

Android browser php cookies

I am unable to manipulate cookies via php on the vanilla android browser. (ver 2.3.4)

The browser options are set to accept cookies, and some websites do allow me to log in normally (though not all).

I have made a really simple test script to try and see if cookies are set at all:

setcookie("TestCookie", "cookievalue", time()+3600);

and on the next page

echo $_COOKIE["TestCookie"];

On my desktop browser or on firefox mobile this displays the word "cookievalue" but on the android browser it's blank. This issue also won't let me store anything in a session cookie since that won't persist.

Am I missing something?

After examining things closely and trying all options I've discovered that this is indeed a problem with how the stock browser is handling cookies when android is configured to use a port and proxy in the APN settings. I suspect that it has problems associating cookies with their domains under certain conditions when these settings are on. (cookies were being set, but lost as soon as a page redirect or link was clicked).

My provider had these in there by default. Removing them so that the fields are blank has solved this problem.

Anyone else having this issue, I suggest going into your wireless networks options, finding the access point names setting, selecting the active APN and clearing the port and proxy fields if they are filled in. (write them down first in case this doesn't work for you)

After you do this you'll have to re-register on your network by searching for available networks and selecting it again.

That code will not work. Cookie data set with setcookie does not become available until the next page request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM