How do I set the expiration time for a cookie saved through curl?

Source: Internet
Author: User
Log on to save the cookie and go to the background page to capture the order data of a website. Now there are two problems: the cookie of the website will expire in 10 minutes. after it expires, you need to log on to the website again to prohibit frequent query of order data. now you need to complete this function: starting from simulated logon... log on to save the cookie and go to the background page to capture the order data of a website.
There are two problems

  • This website cookie will expire in 10 minutes, and you need to log on again after expiration

  • Frequent query of order data of this website is prohibited

Now you need to complete the following functions:

  • Automatically captures order data starting from simulated logon

  • When the cookie expires, a message is automatically sent to the administrator, reminding the administrator to log on again.

So, how do I set the cookie expiration time when simulating logon? And how to set a regular interval to perform a data capture operation?
Is there a way to complete these operations in a local test to process the data?

Reply content:

Log on to save the cookie and go to the background page to capture the order data of a website.
There are two problems

  • This website cookie will expire in 10 minutes, and you need to log on again after expiration

  • Frequent query of order data of this website is prohibited

Now you need to complete the following functions:

  • Automatically captures order data starting from simulated logon

  • When the cookie expires, a message is automatically sent to the administrator, reminding the administrator to log on again.

So, how do I set the cookie expiration time when simulating logon? And how to set a regular interval to perform a data capture operation?
Is there a way to complete these operations in a local test to process the data?

You can run the capture task at a fixed time in cli mode.

I don't think it is necessary to set the cookie expiration time. you can re-simulate logon if the interface fails.

1. frequent query of order data of the website is prohibited
Curl supports proxy requests. it checks whether frequent requests are detected by ip addresses.
2. the cookie of the website will expire in 10 minutes, and you need to log on again after it expires (sessionid is stored in the cookie mainly because the session id will expire instead of the cookie)
Based on your scenario, there are two types of cookie invalidation:
---- 1 the session duration is longer than the session duration configured on the server (generally 30 minutes by default)
---- 2 the user exits and the server actively destroys the session sessionid
Since you want to capture data, the account should be yours, so 2 may be ruled out. As for 1, if you use a curl proxy request, there will be No 1 problem, if you use a scheduled request to keep the session sessionid, you can (open another program to request it every 15 minutes to keep the session)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.