This problem occurs in previous projects to implement cross-server communication. although Mr. Jane told me about the principle of pass before, because no actual operation has been performed, and he is not sure how to implement the pass. I searched for information online and found the p3p Protocol. Its definition is:
P3p is a privacy protection recommendation standard published by the World Wide Web Consortium (W3C). It aims to provide privacy protection for Internet users who surf the Internet. More and more Websites collect user information when consumers access the website. The purpose of making the p3p standard is to alleviate consumers' concerns about potential infringement of privacy due to website collection of personal information. The concept of the p3p standard is: the privacy policy of a Web site should inform the visitor of the type of information collected by the site, who the information will be provided to, how long the information will be retained, and how the information will be used, for example, the website shall make a statement such as "this website will monitor the pages you visit to improve the site usage" or "this website will provide you with more suitable advertisements as much as possible. Users who access the website that supports p3p have the right to view the site privacy report and decide whether to accept cookies or use the website.
Finally, I decided to use cross-domain cookie settings to achieve this requirement.
First, assume that there are Station A (www.aaa.com) and Station B (www.bbb.com). If the two sites are on different servers and in different domains, create a setcookie. php file under Station A. The Code is as follows:
<? PHP
Header ('p3p: Cp = "Cura ADMA Deva psao psdo our bus uni pur int DEM sta pre com nav OTC Noi DSP cor "');
$ Cookie_name = $ _ Get ['name'];
$ Cookie_value = $ _ Get ['value'];
Setcookie ($ cookie_name, $ cookie_value, time () + 3600 );
?>
Next, create a file named B _setcookie.php on Site B. The Code is as follows:
<? PHP
<SCRIPT src = "http://www.aaa.com/setcookie.php? Name = Test & value = bbb.com "> </SCRIPT>
?>
Now, we create another file named getcookie. php under Site A. The Code is as follows:
<? PHP
Echo '<PRE> ';
Print_r ($ _ cookie );
?>
Now we first access the B _setcookie.php file on Site B in the browser, and then visit the getcookie. php file on Site A to see if the corresponding cookie value is printed.