Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

login POST form with cURL

Tags:

curl

login

I am trying to login to the website www.centralgreen.com.sg/login.php using cURL (first time user of cURL)

I used the Tamper plugin for Firefox, and I have 4 POST inputs:

login=mylogin
password=mypassword
Button_DoLogin.x=33
Button_DoLogin.y=6

I tried to use curl again using

curl.exe --data 'login=mylogin&password=mypassword&Button_DoLogin.x=33&Button_DoLogin.y=6' www.centralgreen.com.sg/login.php?ccsForm=Login

But the login apparently doesn't go through (the output of this command is the same form, filled with only the password, and an error message The value in field Username is required.)

Here is the full list of info I get from Tamper

Host centralgreen.com.sg
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept Language en-us,en;q=0.5
Accept Encoding gzip, deflate
Accept Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep Alive 115
Connection keep-alive
Referer http://centralgreen.com.sg/login.php
Cookie PHPSESSID=65fbxxxxxxx02694e3a72xxxxxxxx; Valley_ParkLogin=04E203A459FCxxxxxxxA2DCD9AAE5B9678G08C04F1952155E2482xxxxxxxxxxxxx

Is there anything I do wrong? How can I pass the login through the POST form?

like image 903
RockScience Avatar asked Jul 18 '11 03:07

RockScience


1 Answers

Try using the -F option instead of --data.

http://curl.haxx.se/docs/manpage.html#-F

Basically, this changes the content type header to:

Content-Type: multipart/form-data

This may give you a better result.

like image 128
Brad Avatar answered Oct 09 '22 07:10

Brad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!