简体   繁体   English

在非浏览器客户端(例如Php)中使用Cookie-Android

[英]Use cookies in non-browser clients e.g Php - Android

How can I use cookies in non-browser clients (eg Php - Android) in order to maintain session and other information. 我如何在非浏览器客户端(例如Php-Android)中使用cookie来维护会话和其他信息。

My site is working based on cookies to maintain state, Now when I am writing web services for mobile application, found out that the site is treating each API call as if they are coming from unique user, since cookies are absent. 我的网站正在基于Cookie进行维护,现在,当我为移动应用程序编写Web服务时,由于缺少Cookie,该网站将每个API调用都视为来自唯一用户。

How can I use cookies between PHP(Web service) and android application? 如何在PHP(Web服务)和android应用程序之间使用cookie?

If you want to maintain seesion vars you have to persist the PHP-SESSIONID cookie on each call to your web service as long as you want to keep this session alive. 如果您想维护渗透变量,则必须在每次对Web服务的调用中保留PHP-SESSIONID cookie,只要您想保持该会话有效。

And also the other cookies should be set and sent manually on each request or using the CookieHandler. 另外,应根据每个请求或使用CookieHandler手动设置和发送其他cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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