Answer the question
In order to leave comments, you need to log in
How to save COOKIES in PHP when navigating the site for subsequent automated HTTP requests?
There is such a task : the user walks through a popup-window on a certain site and at a certain moment presses the Save cookies button in this window - after which the COOKIES given by the current page on which the user is at the moment the button is pressed are saved. These COOKIES will then be needed for automated requests to the site.
So far, the following algorithm is in my head :
- use CURL to implement surfing in a popup window around the site
- store the COOKIES of each response temporarily somewhere
- change the links in the received HTML code of the page so that all requests go through my script
- after pressing the Save cookie button re-store COOKIES to persistent storage
Maybe I'm missing something? Any suggestions? Any browser emulator?
ps: to make it clear why I need all this: I am developing a closed automated system for monitoring prices on sites, so prices must be collected from sites, taking into account the choice of city (region) on the site, and on many sites the selected region is stored in COOKIES, so I need it to create an interface for obtaining COOKIES of the desired pages and saving them for subsequent automated requests.
Answer the question
In order to leave comments, you need to log in
when replacing links, you can easily skip links in js.
what you are doing smells bad, in terms of user security. for many sites, of course, it will work, but not for everyone, especially where there is at least some kind of protection (protection from ddos, checking SP, etc.).
in general, if you really do such crap, then this is done through browser extensions.
extensions can leak your cookies, passwords, etc, so they are just made for your purposes)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question