简体   繁体   English

使用htmlunit登录vbulletin论坛

[英]login to vbulletin forums using htmlunit

i am trying to login vbulletins forum using htmlunit 我正在尝试使用htmlunit登录vbulletins论坛

i can connect to my forum and set my username and password but when click in login button i can not login into my user 我可以连接到我的论坛并设置我的用户名和密码,但是当单击登录按钮时,我无法登录我的用户

this is my code : 这是我的代码:

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");
    }

when i get url of page2 result is like "http://mysite.com/login.php?s=36401731df153421f06a8497b3b859df&do=login" 当我得到page2的网址时,结果就像“ http://mysite.com/login.php?s=36401731df153421f06a8497b3b859df&do=login”

please help me to fix my problem , thank you 请帮助我解决我的问题,谢谢

I set these values in the below tags and I could login to my user: 我在以下标记中设置了这些值,然后可以登录到我的用户:

input type="hidden" name="vb_login_md5password"
input type="hidden" name="vb_login_md5password_utf"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM