2012-04-01 35 views
0

下面是一个简单的登录页面,其工作原理为登录面板4shared.com:cURL:如何制作登录脚本(使用https协议)?

<form id="login_form" method="post" action="https://www.4shared.com/index.jsp"> 
    <input type="text" placeholder="username" name="login" id="iloginfield"> 
    <input type="password" placeholder="password here" name="password" id="ipassfield"> 
    <input type="submit" value="Login"> 
</form> 

它的工作原理。 我以为我可以简单地运行:

curl "http://www.4shared.com/index.jsp" -d "login=xxxxxxx&password=yyyyyyyyyyyyy" -D "/tmp/header.txt" 

哪些应该有工作。 但它失败了。

为什么?我怎么做到的?

+0

它以什么样的方式失败?另外,我看到这个表单引用了一个'https://'URL,但是你使用'http://'。这是出于特定原因吗?它是否也失败了在表单中使用URL引用? – larsks 2012-04-01 01:57:52

+1

我发现我刚刚输入了错误的编码密码...真是太遗憾了.. – Determinant 2012-04-01 02:01:51

回答

0

你看到了什么输出?您可能需要存储服务器发送给您的Cookie。

-c/--cookie-jar <file name> 
      Specify to which file you want curl to write all cookies after a 
      completed operation. Curl writes all cookies previously read 
      from a specified file as well as all cookies received from 
      remote server(s). If no cookies are known, no file will be writ‐ 
      ten. The file will be written using the Netscape cookie file 
      format. If you set the file name to a single dash, "-", the 
      cookies will be written to stdout. 

      NOTE If the cookie jar can't be created or written to, the whole 
      curl operation won't fail or even report an error clearly. Using 
      -v will get a warning displayed, but that is the only visible 
      feedback you get about this possibly lethal situation. 

      If this option is used several times, the last specified file 
      name will be used. 
+0

对不起。我发现我刚刚输入了错误的编码密码... – Determinant 2012-04-01 02:00:13