cURL并单击网站中的按钮 [英] cURL and click a button in a website

查看:164
本文介绍了cURL并单击网站中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用cURL单击网站上的某个按钮最简单的脚本是什么?

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

谢谢

推荐答案

您最好的选择是使用Firebug或Live HTTP Headers插件(均适用于Firefox)之类的方法来尝试实际单击该按钮并查看产生的结果。然后尝试复制它。

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.

这是一个简单的示例,

网站上的表单:

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

在第一个框中键入 Some value number one,在第一个框中键入 Some value number two第二个框,然后单击提交按钮将生成一个类似于

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

会转换为类似culrl的命令,例如

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

这篇关于cURL并单击网站中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆