PHP Cooki cross-domain
Ask a Master to guide you. How to operate.
Also explain in detail the parameters of the domain in PHP setcookie, and the problem
For example: Setcookie ("name", "Value", Time () +3600, "path", "domain", "http");
The requirements of Domian in the interim. For example: I have two sites demo.xx.com admin.xx.com this, how to set up domain.
. xx.com this way, or, how, to seek master guidance.
Reply to discussion (solution)
Setcookie ("name", "Value", Time () +3600, "/", "xx.com");
Setcookie ("name", "Value", Time () +3600, "/", "xx.com");
Does this look possible? Can I cross the domain? Have you ever tested it?
Could you please test it yourself?
Could you please test it yourself?
OK, I'll test it.
Cookie cross-domain is required for JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
Cookie cross-domain is required for JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp ... How to get.
Could you please test it yourself?
I tested it, no. hms.org.cn. So set, then, in xxx.hms.org.cn this domain name can.
However, the demo.hms.org.cn cannot be obtained. to a cookie
Reference 5 Floor Hellodifa reply: The cookie cross-domain is needed to use JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp ... How to get.
For security reasons, the browser does not support the cross-domain of the B-site cookies, but if both A and B sites are yours, they can be supported across domains, but the information on the B site needs to be modified.
There are many examples on the internet, such as: http://www.nowamagic.net/javascript/js_UseJsonpCrossDomain.php
reference 6 floor Xviphackl reply: Reference 5 floor Hellodifa reply: The cookie cross-domain is needed to use JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp ... How to get. For security reasons, the
Browser does not support a site-to-site cookie cross-domain, but as ...
Thank you very much for the information you have given me, I now understand the principle of JSONP.
I'm going to explain my problem, what I need to do now is.
A, b two stations, a responsible for the front desk b background
A station only a index.php file, B station is responsible for the whole station processing. They deal with different domain names.
I log in A, B station also to log in (if the direct access to B station can be normal).
However, the login from a station is not successful.
My initial solution was to use JS to give the value of a cookie to station B, the value of a login cookie, but still solve the problem.
Can I say that you understand?
Reference 6 Floor Xviphackl reply: Reference 5 floor Hellodifa reply: Cookie cross-domain is required to use JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp ... How to get.
For security reasons, browsers do not support the cross-domain of a-site-to-site cookie, but such as ...
To rectify a small problem,
is from a station login, prompt success but, and did not succeed.
If you log in directly from station B, you can log in successfully.
A station has only one file, which takes the results from B back (file_get_contents) to a station.
Reference 8 Floor Hellodifa reply: Reference 6 floor Xviphackl reply: Reference 5 floor Hellodifa reply: The cookie cross-domain is need to use JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp ... How to get.
Browser for security reasons, is not supported ...
If a station already has a B station cookie, but to the B station crawl is not successful, it is possible to go to the B station crawl there is a problem, the cookie has been transmitted and so on.
Reference 10 Floor Xviphackl reply: Reference 8 floor Hellodifa reply: Reference 6 floor Xviphackl reply: Reference 5 floor Hellodifa reply: The cookie cross-domain is needed to use JSONP.
Setcookie ("name", "Value", Time () +3600, "/", "xx.com") are not allowed to cross other people's domain names.
How to test Jsonp. ......
Well, thank you!! I'll check it out. Looking at the years is not a problem of crawling data.
A station print Cookie B station also print cookies
From a station access login, B station of the cookie is empty, (2 stations are supposed to have a cookie from a station to the B station, the B station print the cookie should be able to read the never domain cookie why is empty. )。
I guess that's why,
A station only one to crawl data ... B Station is the implementation of the method, a station has a B station login Cookie Why B station this side to get from a to the B station's a station cookie?
Supposedly, both sides of the cookie domain are set, why not get it?
A station only one to crawl data ... B Station is the implementation of the method, a station has a B station login Cookie Why B station this side to get from a to the B station's a station cookie?
A curl is used to crawl? Curl passes the parameter cookie in.
A to grab B's things, a does not pass to Bcookie, B is unable to know what a cookie is AH.
A station only one to crawl data ... B Station is the implementation of the method, a station has a B station login Cookie Why B station this side to get from a to the B station's a station cookie?
A curl is used to crawl? Curl passes the parameter cookie in.
A to grab B's things, a does not pass to Bcookie, B is unable to know what a cookie is AH.
Without using curl to crawl, using the file_get_contents function, is it necessary to use curl to capture data for this data interaction?
This is a station access,
File_get_contents This function is to go to a Web site crawl information, the equivalent of directly in the browser to enter an address to request, it is certainly not access to your server cookie.
Like, you use your own computer browser to access a website, how this site knows your computer's cookie.
OK, teachable. Now know which link is out of the question, thank you first.
Let's find out first, check the bill ...
File_get_contents This function is to go to a Web site crawl information, the equivalent of directly in the browser to enter an address to request, it is certainly not access to your server cookie.
Like, you use your own computer browser to access a website, how this site knows your computer's cookie.
Send my sincerity again, thank you. The problem is solved. Which is the reason you said.
File_get_contents did not pass the value of the cookie in the past. Let B station do not know, a station exactly what is a cookie.
Thanks again.
I also encountered this function problem, not the General Assembly, the landlord succeeded, can give a simple and meticulous example? I appreciate it.