Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using cURL to POST data to a form

Tags:

curl

I'm trying to use cURL to post data to the form on this URL:

  http://dq.sdc.bsnl.co.in/dq/reversePhone.seam?cid=812363

Seeing its source, the form looks like

<form id="revPhone" name="revPhone" method="post" action="/bsnl-web/reversePhone.seam;jsessionid=D238FA7A23A89A38C56B808B96F5D212" enctype="application/x-www-form-urlencoded" onkeyup="if (!check2(event)) {return false;};A4J.AJAX.Submit('loader2','revPhone',event,{'eventsQueue':'myqueue','parameters':{'revPhone:j_id16':'revPhone:j_id16'} ,'actionUrl':'/bsnl-web/reversePhone.seam;jsessionid=D238FA7A23A89A38C56B808B96F5D212','requestDelay':5} )">

<input type="hidden" name="revPhone" value="revPhone" />
<input type="hidden" name="revPhone:j_id12" />
<input id="revPhone:firstField" type="text" name="revPhone:firstField" maxlength="8" onkeydown="return removeEnter1(event)" />

Code pasted here: http://hastebin.com/wihunayilu.xml

Trying curl with these values:

curl --data "revPhone:firstField=24988872&revPhone:city=CHENNAI" http://dq.sdc.bsnl.co.in/dq/reversePhone.seam?cid=812363 

I end up with the same page again as a response. How can I see (using firebug?) what parameters are passed to a post form so that I can correctly send the request to the server?

Thanks a lot

like image 600
Prakhar Avatar asked Feb 25 '12 17:02

Prakhar


1 Answers

You need to tell curl to make a POST

curl -X POST ....
like image 96
Juri Glass Avatar answered Sep 22 '22 14:09

Juri Glass