Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the p3p header by php

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Php how to set P3P head, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Php set P3P header method: 1, edit HOST, add "127.0.0.1 www.a.com"; 2, create a_setcookie.php and a_getcookie.php files; 3, set P3P header through header.

This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.

How does php set the P3P header?

PHP implements cross-domain access to COOKIE by setting P3P headers.

Mine is a CentOS system (Linux kernel)

Edit HOST

Vi / etc/hosts

Join

127.0.0.1 www.a.com127.0.0.1 www.b.com

First, create an a_setcookie.php file with the following contents:

Then: create an a_getcookie.php file with the following contents:

Finally: create a b_setcookie.php file with the following contents:

--

After the three files are created, we visit them one by one through the browser:

Http://www.b.com/b_setcookie.phphttp://www.a.com/a_getcookie.php

We will find that when accessing the b.com domain, we did not set a cookie value on the a.com domain.

Then we modify the a_setcookie.php file to remove the comment symbols, and a_setcookie.php is:

Access again through the browser in turn:

Http://www.b.com/b_setcookie.phphttp://www.a.com/a_getcookie.php

This time, you will find that when you visit the b.com domain, we set the cookie value for the a.com domain.

Finally, it seems that only IE has strict restrictions on cross-domain access to COOKIE. The above code can be successfully tested under FIREFOX even without sending P3P header information.

= =

Undefined

Through Fiddler, you can easily know the meaning of the above P3P code.

P3P Header is present:CP= "CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Compact Policy token is present. A trailing 'o'means opt-out, a trailing 'i'means opt-in.CURaInformation is used to complete the activity for which it was provided.ADMaInformation may be used for the technical support of the Web site and its computer system.DEVaInformation may be used to enhance, evaluate, or otherwise review the site, service, product, or market.PSAoInformation may be used to create or build a record of a particular individual or computer that is tied to a pseudonymous identifier, without tying identified data (such as name, address, phone number, or email address) to the record. This profile will be used to determine the habits, interests, or other characteristics of individuals for purpose of research, analysis and reporting, but it will not be used to attempt to identify specific individuals. PSDoInformation may be used to create or build a record of a particular individual or computer that is tied to a pseudonymous identifier, without tying identified data (such as name, address, phone number, or email address) to the record. This profile will be used to determine the habits, interests, or other characteristics of individuals to make a decision that directly affects that individual, but it will not be used to attempt to identify specific individuals.OURWe share information with ourselves and/or entities acting as our agents or entities for whom we are acting as an agent.BUSInfo is retained under a service provider's stated business practices. Sites MUST have a retention policy that establishes a destruction time table. The retention policy MUST be included in or linked from the site's human-readable privacy policy.UNINon-financial identifiers, excluding government-issued identifiers, issued for purposes of consistently identifying or recognizing the individual. These include identifiers issued by a Web site or service.PURInformation actively generated by the purchase of a product or service, including information about the method of payment.INTData actively generated from or reflecting explicit interactions with a service provider through its site-- such as queries to a search engine, or logs of account activity.DEMData about an individual's characteristics-- such as gender, age And income.STAMechanisms for maintaining a stateful session with a user or automatically recognizing users who have visited a particular site or accessed particular content previously-such as HTTP cookies.PREData about an individual's likes and dislikes-such as favorite color or musical tastes.COMInformation about the computer system that the individual is using to access the network-such as the IP number, domain name, browser type or operating system.NAVData passively generated by browsing the Web site-such as which pages are visited And how long users stay on each page.OTCOther types of data not captured by the above definitions.NOIWeb Site does not collected identified data.DSPThe privacy policy contains DISPUTES elements.CORErrors or wrongful actions arising in connection with the privacy policy will be remedied by the service.Validate at: http://www.w3.org/P3P/validator.htmlLearn more at: http://www.fiddlertool.com/redir/?id=p3pinfo, is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report