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

Source: Internet
Author: User
Tags session id
Save the cookie by simulating login, and then go to the background page to constantly crawl the order data on a website.
Now there are two problems.

    • The site cookie expires after 10 minutes and requires a login after it expires

    • The site's order data prohibit frequent inquiries

Now it's time to complete this function:

    • Automatically capture order data from the start of an analog login

    • Automatically sends a message to the administrator when the cookie expires, reminding the administrator to sign in again.

So, how do I set the saved cookie expiration time when I log in? And how to set every fixed time to perform a fetch data operation?
Is there a way to do this in a local test because of the processing of this data?

Reply content:

Save the cookie by simulating login, and then go to the background page to constantly crawl the order data on a website.
Now there are two problems.

    • The site cookie expires after 10 minutes and requires a login after it expires

    • The site's order data prohibit frequent inquiries

Now it's time to complete this function:

    • Automatically capture order data from the start of an analog login

    • Automatically sends a message to the administrator when the cookie expires, reminding the administrator to sign in again.

So, how do I set the saved cookie expiration time when I log in? And how to set every fixed time to perform a fetch data operation?
Is there a way to do this in a local test because of the processing of this data?

To perform a crawl at regular intervals, you can use the CLI mode timer task.

Cookie set expiration time I don't think it is necessary for you to re-impersonate the login if the interface fails.

1 The site's order data prohibit frequent inquiries
Curl supports proxy requests, and he detects whether frequent requests are detected by IP
2 The site cookie expires after 10 minutes and needs to be re-logged after it expires (the cookie contains the SessionID that the session ID will expire, not a cookie)
According to your scenario, there are 2 types of cookie failures:
----1 session duration scrambled over server configured session duration (typically 30 minutes by default)
----2 user exits, the server actively destroys the session SessionID
Since you are to grasp the data, then the account should be yours, then 2 of the possible basic can be ruled out, as for 1 if you use the Curl Proxy request Then there is no 1 problem, If you are using a timed request to keep the session SessionID (another program requests every 15 minutes to keep the session)

  • Related Article

    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.