简体   繁体   English

如何从同一个浏览器收集一个域的相同cookie到另一个域?

[英]How to collect the same cookies of one domain to another domain from the same browser?

I have opened an anonymous website say example.com in a browser. 我在浏览器中打开了一个匿名网站say.com Now I am running a PHP script which runs in another domain say test.com which is owned by me in another Tab from the same browser. 现在我正在运行一个PHP脚本,该脚本在另一个域中运行,例如test.com ,它由我在同一浏览器的另一个Tab中拥有。 How can I get all the cookies which were set in example.com into my test.com PHP script? 如何将example.com中设置的所有cookie都放入我的test.com PHP脚本中? The objective is to collect all the same cookies that were set in example.com & process those same cookies in my PHP script. 目标是收集在example.com中设置的所有相同的cookie,并在我的PHP脚本中处理相同的cookie。

Any advice would be much appreciated? 任何建议将不胜感激?

You cannot get cookie information from one domain to another. 您无法从一个域获取cookie信息到另一个域。 It would be a massive security hole. 这将是一个巨大的安全漏洞。

If you absolutely need the values, you will need to add a page to domain1 which reads the cookie and redirects to domain2, passing the cookie values as a query string or form parameter. 如果您绝对需要这些值,则需要向domain1添加一个页面,该页面读取cookie并重定向到domain2,将cookie值作为查询字符串或表单参数传递。

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

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