When visiting a page, the application can only obtain some cookies.

WBOY
Release: 2016-08-18 09:16:26
Original
1241 people have browsed it

Problems
1. When visiting a page, a cookie is generated, and the program can only obtain part of it, which is inconsistent with the cookie accessed by the browser.
2. The cookie in the response header has been obtained.
Want to get the cookie in the request header.
3. Test link: http://i.umeng.com/

Supplementary:
Backend service acquisition

Step 1: Clear browser cookies
Step 2: When requesting this address for the first time, you find that the request header contains related cookies, and you want to obtain the cookie.
In the response headers of other visits, no cookie settings were found, so I am curious about where the cookies in the request headers come from.

When visiting a page, the application can only obtain some cookies.

I want to get the values ​​of the following two names in the cookie
When visiting a page, the application can only obtain some cookies.


Cause of the problem: cookie generated by js

Reply content:

Problems
1. When visiting a page, a cookie is generated, and the program can only obtain part of it, which is inconsistent with the cookie accessed by the browser.
2. The cookie in the response header has been obtained.
Want to get the cookie in the request header.
3. Test link: http://i.umeng.com/

Supplementary:
Backend service acquisition

Step 1: Clear browser cookies
Step 2: When requesting this address for the first time, you find that the request header contains related cookies, and you want to obtain the cookie.
In the response headers of other visits, no cookie settings were found, so I am curious about where the cookies in the request headers come from.

When visiting a page, the application can only obtain some cookies.

I want to get the values ​​of the following two names in the cookie
When visiting a page, the application can only obtain some cookies.


Cause of the problem: cookie generated by js

Do you want to get the cookie through js or get the cookie with the request in the back-end service?
This is the login of Umeng. I checked the cookies and they are all normal.

If you want the server to obtain the cookie included in the request, check whether your web server address is in the same domain as the interface server address. If not, you must manually set the cookie across domains when the front-end page sends a request.

Normally, if the web server and the interface server have the same domain name, every time a request is sent to the interface server, the browser will automatically bring all the cookies under the domain name, and the interface server will filter them through the cookie-name set in advance. Your own cookie.

I don’t know if this helps you. Can you describe it more clearly? Or what do you want to use this for?

There is a problem with understanding
Do you want to set the cookie first and then get the cookie you set in the same request? This is of course impossible.
The set cookie can only be obtained on the next request.

In other words,
If you set the cookie value first in a request, then you must know what the set value is and you can use this value directly. Why do you need to obtain it through the cookie?

The cookie in the request header is set when you make the request. .

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!