shell - 使用cURL在网页中登录

标签 shell post curl

我正在寻找任何方式登录包含此数据的网页:

--- FORM report. Uses POST to URL "<form name="form1" method="post" >"
Input: NAME="login" (TEXT)
Input: NAME="password" (PASSWORD)
Input: NAME="Submit" VALUE="Continue &raquo;" (IMAGE)

使用此 cURL 命令:

curl -d "login=john" -d "password=venus123&submit=Continue%20&raquo;" URL

我得到这个输出:

<h1>The page cannot be displayed</h1>
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
<hr>

你能帮我吗?

最佳答案

这是数据的urlencoding问题。您需要将 raquo 之前的 & 字符更改为 %26

curl -d "login=john" -d "password=venus123&submit=Continue%20%26raquo;" URL
                                                             ^^^ here

此外,如果您的密码包含特殊字符,那么您也必须对它们进行 urlencoding。您可以在互联网上免费找到在线 urlencoder。

关于shell - 使用cURL在网页中登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35565096/

相关文章:

ruby-on-rails - Ruby/Rails 性能 : OpenURI vs NET:HTTP vs Curb vs Rest-Client

http - Golang : Why does response. Get ("headerkey") 这段代码没有返回值?

linux - 如何在没有行号或 ASCII 表的情况下仅打印来自 hexdump 的十六进制值?

linux - 创建 Zip 文件 Fedora 17

bash - VSCode 集成终端不加载 .bashrc 或 .bash_profile

javascript - JQuery 无法将数据发布到 SPRING MVC Controller

php - linux 文件大小

asp.net - ASP.NET 中 HTTP 和 HTTPS 页面之间的 Request.Form

javascript - Node.js Express : Redirect or render on post

curl - 不使用 curl 将数据索引到 ElasticSearch