2012-04-01 87 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