2

wget と --post-data および --save-cookies オプションを使用して、Web サイトのログイン フォームを通過することができました。

今、私はウェブページのいくつかのフィールドに入力して送信しようとしています。問題は、Web ページに「turing」隠しフィールドがあり、毎回異なる値になることです。

私が試したのは、Cookie をロードした状態で Web ページを開き、turing 値を取得することです。次に、--post-data を使用して別の wget を実行し、turing フィールドを含むすべてのフィールドをそこに配置します。しかし、うまくいきません。

また、ウェブページにはいくつかのフォームがあるので、フォーム名を追加する必要があると思います。正しい?

何か案は?

<form action="article.php" method="post" name="postmessage">
 <table width="100%" class="table_lines" border="0" cellspacing="0" cellpadding="6">
  <tr>
   <td>subject</td>
   <td><input type="text" name="messageinput[0]" value=""></td>
  </tr>
  <tr>
   <td>tags</td>
   <td><input type="text" name="messageinput[1]" value=""></td>
  </tr>
  <tr>
   <td>Message</td>
   <td><input type="text" name="messageinput[2]" value=""></td>
  </tr>
  <td colspan="2" align="center"><input name="mesbut" type="submit" value="Post Message" onclick="document.postmessage.mesbut.value='Posting..'; document.postmessage.mesbut.disabled=true;document.postmessage.submit();"></td>
 </table>
 <input type="hidden" name="turing" value="wgbyp">
</form>

だから私が試したのは(ログイン後)です:

/usr/bin/wget -q --load-cookies cookie.txt http://www.myurl.com/article.php -O output.html
TURING=$(sed -n -e 's/.*name="turing" value="\(.*\)">.*/\1/p' output.html)

/usr/bin/wget -q --load-cookies cookie.txt --post-data "messageinput[0]=mysubject&messageinput[1]=&messageinput[2]=mymessage&turing=${TURING}&postmessage=1&mesbut=1"  http://www.myurl.com/article.php -O output2.html

しかし、それは機能していません。

4

2 に答える 2

1

最初の wget は --save-cookies を使用する必要があります。

あなたの例では、cookie.txt で何かを得ていますか?

于 2014-02-14T17:01:34.627 に答える
0

私の情報はうまくいったようです。Web ページに十分なフィールドを提供しなかっただけです。

于 2014-02-19T10:28:02.667 に答える