CURL and click on the website button

What is the simplest script using cURL to click a specific button on a website?

thanks

+4
source share
2 answers

It is best to use something like Firebug or Live HTTP Headers (both for Firefox) to actually try to click a button and see what happens as a result of the request. Then try to repeat it.

Here is a simple example:

website form:

<form action="http://someUrl.com/somePage.html" method="POST"> <input type="text" name="value1"> <br /> <input type="text" name="value2"> <br /> <input type="submit"> </form> 

In the first field, enter "Some value number one", typing "Second value number two" in the second field and clicking the "Send" button, you will receive a request that looks something like

 POST /somePage.html HTTP/1.1 Host: someUrl.com ...//various other POST headers here Content-Type: application/x-www-form-urlencoded Content-Length: 57 value1=Some+value+number+one&value2=Some+value+number+two 

which translates to cUrl command, for example

 curl -d "value1=Some%20value%20number%20one&value2=Some%20value%20number%20two" http://someUrl.com/somePage.html 
+10
source

cURL does not parse the DOM itself. But pressing a button is probably just a form that curl can do. But first you need to find out the details (exact fields and any cookies).

+1
source

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


All Articles