我正在尝试使用cURL将数据发布到此网址上的表单:
http://dq.sdc.bsnl.co.in/dq/reversePhone.seam?cid=812363
看到它的来源,表格看起来像
<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)" />
<input id="revPhone:city" type="text" name="revPhone:city" value="Enter City Name" onblur="defaultText1();hideImage()" onfocus="defaultText2()" onkeyup="showImage(event)" />
此处粘贴代码:http://hastebin.com/wihunayilu.xml
尝试使用这些值的curl:
curl --data "revPhone:firstField=24988872&revPhone:city=CHENNAI" http://dq.sdc.bsnl.co.in/dq/reversePhone.seam?cid=812363
我最后再次使用相同的页面作为回复。我如何看到(使用firebug?)传递给帖子表单的参数,以便我可以正确地将请求发送到服务器?
非常感谢
答案 0 :(得分:1)
表单使用ajax发布到URL,该URL返回带有元标记重定向的页面。我做了什么看到params是在调试器打开的情况下提交表单(我使用了chrome的开发工具,但这也可以在firebug中工作),然后在调用完成之前快速按下escape。 params看起来像这样:
AJAXREQUEST:loader2
revPhone:revPhone
revPhone:j_id12:
revPhone:firstField:24988872
revPhone:city:CHENNAI
revPhone:suggestionBoxId_selection:
javax.faces.ViewState:j_id4
revPhone:search:revPhone:search
,回复是:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta name="Ajax-Response" content="redirect" />
<meta name="Location" content="/bsnl-web/debug.seam;jsessionid=(some JSESSIONID)?cid=877632" />
</head></html>
(我编辑了我的jsessionid)
我的卷曲线是:
curl --data "AJAXREQUEST=loader2&revPhone:suggestionBoxId_selection=&javax.faces.ViewState=j_id4&revPhone:search=search&revPhone=revPhone&revPhone:j_id12=&revPhone:firstField=24988872&revPhone:city=CHENNAI" http://dq.sdc.bsnl.co.in/dq/reversePhone.seam?cid=812363