Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cURL and click a button in a website

Tags:

scripting

curl

what is the simplest script using cURL of clicking a certain button on a website?

Thanks

like image 404
Open the way Avatar asked Mar 02 '10 20:03

Open the way


People also ask

Can I use curl to login to a website?

For example, if a website has protected content curl allows you to pass authentication credentials. To do so use the following syntax: curl --user "USERNAME:PASSWORD" https://www.domain.com .

Can I use curl in browser?

With ReqBin Online Curl Client, you can run Curl commands directly from your browser. No desktop apps or browser plugins required. Just enter the Curl command and click on Run. Built-in Curl command syntax Highlighter will highlight Curl command syntax while you type Curl command.

How do I make my website curl?

To make a GET request using Curl, run the curl command followed by the target URL. Curl automatically selects the HTTP GET request method unless you use the -X, --request, or -d command-line option. In this Curl GET example, we send Curl requests to the ReqBin echo URL.

What is a website curl?

What Is cURL? cURL is a command-line tool that you can use to transfer data via network protocols. The name cURL stands for 'Client URL', and is also written as 'curl'. This popular command uses URL syntax to transfer data to and from servers.


1 Answers

Your best bet is to use something like Firebug or the Live HTTP Headers plugin (both are for Firefox) to try actually clicking the button and seeing what is going into the resulting request. Then try to replicate it.

Here's a simple example, though:

a form on a web site:

<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>

Typing "Some value number one" in the first box, typing "Some value number two" in the second box, and clicking the submit button would generate 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 would translate into a cUrl command like

curl -d "value1=Some%20value%20number%20one&value2=Some%20value%20number%20two" http://someUrl.com/somePage.html
like image 106
Jacob Mattison Avatar answered Oct 04 '22 19:10

Jacob Mattison