2010-03-02 85 views

回答

10

最好的办法是使用类似Firebug或Live HTTP Headers插件(都适用于Firefox)来尝试实际点击按钮并查看将要产生的请求的内容。然后尝试复制它。

这里有一个简单的例子,虽然:

在网站上的一种形式:

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

键入“一些价值一把手”在第一个框中,键入在“一些价值二把手”第二个框,然后点击提交按钮会产生看起来像

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 

这将转化为一个curl命令像

请求
curl -d "value1=Some%20value%20number%20one&value2=Some%20value%20number%20two" http://someUrl.com/somePage.html 
1

卷曲不分析一个DOM本身。但点击按钮可能只是提交一个表单,这个表单可以卷曲。但是你首先需要弄清楚细节(确切的字段和任何cookie)。