Cleaning a site that wants to receive a cookie

I am trying to clear a remote website. I am using PHP Curl and my code is good. I know, because I used Fiddler, Tamper Data, etc., to get my code just right. But he still did not work. So, I tried something that I had to check a few hours ago:

I have disabled cookies in my browser. Of course, I can’t look for a remote site right now. Their code requires a cookie to search for the products I want to clear.

Is there any way to fake / cheat / circumvent so that I can clean the site? Can I tell CURL to use cookies that I upload? I don’t even know the right question to ask.

+4
source share
2 answers

Take a look at the various curl_setopt options for cookies.

You can use CURLOPT_COOKIE to manually set cookies or use CURLOPT_COOKIEJAR and a file on disk to actually store and store cookies in multiple requests.

However, you probably only need a session cookie, which the manual says is supported by default - as long as you use the same curl instance for each request. If you create a new curl instance for each request, these instances will not transmit cookies.

+9
source

Source: https://habr.com/ru/post/1341214/


All Articles