0

htmlunitを使用してvbulletinsフォーラムにログインしようとしています

フォーラムに接続してユーザー名とパスワードを設定できますが、ログインボタンをクリックするとユーザーにログインできません

これは私のコードです:

try{

        final WebClient webClient = new WebClient();

        webClient.getOptions().setJavaScriptEnabled(false);
        webClient.getOptions().setCssEnabled(false);        



        final HtmlPage page1 =(HtmlPage) webClient.getPage("http://mysite.com/forum.php");

        final HtmlForm form1 = (HtmlForm) page1.getElementById("navbar_loginform"); 

        final HtmlSubmitInput button= form1.getInputByValue("login"); 
        final HtmlTextInput username = form1.getElementById("navbar_username");

        final HtmlTextInput password = form1.getElementById("navbar_password_hint");


        username.setValueAttribute(txtusername.getText());
        password.setValueAttribute(String.valueOf(txtpasswd.getPassword()));


       final HtmlPage page2 =button.click();


        webClient.closeAllWindows();

    }
    catch(Exception x)
    {
        JOptionPane.showMessageDialog(null, "can not connect");
    }

page2のURLを取得すると、結果は「http://mysite.com/login.php?s=36401731df153421f06a8497b3b859df&do=login」のようになります。

私の問題を解決するのを手伝ってください、ありがとう

4

1 に答える 1

0

これらの値を以下のタグに設定すると、ユーザーにログインできました。

input type="hidden" name="vb_login_md5password"
input type="hidden" name="vb_login_md5password_utf"
于 2012-12-26T11:42:21.047 に答える