Cross browser cookie in php. Pass cookies between

2019-01-29 10:04发布

I have created an application and I am trying to pass a cookie from one to another application that works in two different ports in apache. (Like application1 in 80 and Application2 in 8080).

That works fine but, when I open the same application in different browsers, the cookie is not being shown in the Application2. Only when I open the application in same browser it is fine.

What am I missing?

5条回答
太酷不给撩
2楼-- · 2019-01-29 10:31

Cookies are not shared between browsers. You'd have to rely on database/session id or tools such as this one:

http://www.ts0.com/crosscookie/example.html

Cheers

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-29 10:38

Try using server side cookies with few a!! May be it can be of some help

查看更多
4楼-- · 2019-01-29 10:52

You can use session identifier and to store the cookie value on a server.

Application 1/Browser 1 - http://blabla/lele.php?cookieid=euueury576edhdhrtrtrt

Store the cookie info into SQL

Cookie id | Cookie info (serialized)
euueury576edhdhrtrtrt | ...... 

Application 1/ Browser 2 - http://blabla/lele.php?cookieid=euueury576edhdhrtrtrt Here you can extract the cookie information from the server and set it on the new browser.

Using the similar scheme you can update the cookies between browsers also.

查看更多
叼着烟拽天下
5楼-- · 2019-01-29 10:57

A cookie is a HTTP header sent from the webserver to the browser. The browser then stores the contents of said header on disk or memory, based on the parameters defined for this cookie. Cookies are not shared between browsers.

HTTP Cookie on Wikipedia

查看更多
孤傲高冷的网名
6楼-- · 2019-01-29 10:57

You can't set the cross browser cookies, cookies are set in the specific browser not at the server side.

One thing you can do is IP tracking, means you start storing the IP at your server, and the same call from different browser comes you set the cookie in that browser from server.

查看更多
登录 后发表回答