cURL 和网站登录

cURL and website login

我正在尝试使用 cURL 登录网站 FictFact (http://www.fictfact.com)。我查看了以前关于一般主题的 Whosebug posts 并尝试了许多不同的解决方案,但没有找到合适的解决方案。

curl --data "UserName=name&Password=pass&RememberMe=false" http://www.fictfact.com/account/logon

这是一个 returns 对象移动消息。

curl --form "UserName=name&Password=pass&RememberMe=false&submit=Login" http://www.fictfact.com/account/logon

这个returns登录表单页面的HTML。我在没有 "submit" 和 -X POST.

的情况下进行了尝试

最后,我尝试了几种发送 cookie 的变体: curl -c cookies.txt http://www.fictfact.com/account/logon 这将创建 cookies.txt 文件,然后我使用此调用来使用它: curl -b cookies.txt --form "UserName=name&Password=pass&RememberMe=false&submit=Login" --dump-header headers http://www.fictfact.com/account/logon

这仍然只是 returns 登录表单...不是 post 认证页面。

这是特定于站点的问题还是我遗漏了一些一般性问题?

谢谢!

使用 Martin Konecny 回答我登录正常:

$ curl --data "UserName=plebian&Password=password&RememberMe=false" http://www.fictfact.com/account/logon --dump-header headers 
$ curl -L -b headers http://www.fictfact.com/Account/LogOn 

[..]
 <div class="navitems">
                Welcome <strong>plebian</strong>!
    [ <a href="/account/logoff">Log Off</a> ]
[..]