开发者

Input values to textfields, stream back to website

开发者 https://www.devze.com 2023-03-20 04:22 出处:网络
I connected to a website, used JSoup to find the \"textfield\" ID\'s, input the values, now i need to stream it out.

I connected to a website, used JSoup to find the "textfield" ID's, input the values, now i need to stream it out.

Can someone please help me with the correct coding to stream the "modified" doc back to the website?

if (source == enter2) 
{

            String URL = "http://www.clubvip.co.za/Login.aspx";
            Element number;
            Element pass;
            Element keyword;
            try {
                Document doc = Jsoup.connect(URL).get();
                number = doc.getElementById("ctl00_ContentPlaceHolder1_CellNumberRadText").attr("value", "number");
                System.out.println(number);
                pass = doc.getElementById("ctl00_ContentPlaceHolder1_PasswordRadText").attr("value", "password");
                System.out.println(pass);
                keyword = doc.getElementById("ctl00_ContentPlaceHolder1_KeyWordRadText").attr("value", "keyword");
                System.out.pri开发者_运维知识库ntln(keyword);


Why are you doing it like this?

If you need to login to that webpage, simply take arguments and send them via HTTP POST request to page where <form> points to

which is <form method="post" action="login.aspx">


Instead of what you are doing:

Jsoup.connect("http://www.clubvip.co.za/Login.aspx")//
     .data("ctl00_ContentPlaceHolder1_CellNumberRadText", "number", 
           "ctl00_ContentPlaceHolder1_PasswordRadText", "password",
           "ctl00_ContentPlaceHolder1_KeyWordRadText", "password").post();

not tested, so possibly not 100% correct...

0

精彩评论

暂无评论...
验证码 换一张
取 消