2017-08-01 5 views
-2

私はこのページにログインしようとしていますhttps://www.gpro.net/gb/gpro.aspJsoupと私はほとんどすべての私の髪を引っ張っています、それはちょうど動作しません。ここでJsoupでこの特定のページにログインするにはどうすればよいですか?

は、私がしようとしてきたものです:

Connection.Response loginForm = Jsoup.connect("https://www.gpro.net/gb/gpro.asp") 
      .method(Connection.Method.GET) 
      .execute(); 

      Document document = Jsoup.connect("https://www.gpro.net/gb/gpro.asp") 
      .data("cookieexists", "false") 
      .data("Text1", "myEmail") 
      .data("Password2", "myPassword") 
      .cookies(loginForm.cookies()) 
      .post(); 
      System.out.println(document); 

、ここでは、フォームは

<form method="post" action="Login.asp?Redirect=gpro.asp" ID="Form1" style="margin:0px"> 
     <h1>Quick login</h1> 
     <div class="inner"> 

     <label for="textLogin">Username or Email address:</label> 
     <input type="text" name="textLogin" value="" class="texty" ID="Text1"> 
     <label for="textLogin">Password:</label> 
     <input type="password" name="textPassword" class="texty" ID="Password2"> 
     <input type="hidden" name="token" value="" ID="token"> 
     <input type="hidden" name="Logon" value="Login" ID="Hidden1"> 
     <input type="submit" name="LogonFake" value="Login" class="halo micro" ID="Submit2"> 
     <a href="LostPassword.asp" class="password">Forgotten your password?</a>   
     <div class="center" style="clear:both; float:left; width:100%; text-align:center; margin:-3px 0 11px !important;"> 
      <a class="fb_button fb_button_medium" href="#" onclick="fbLogin()" style="border-radius:6px 6px 6px 6px; display:inlineblock;"> 
       <span style="border-radius:0 6px 6px 0; background-clip: padding-box;" class="fb_button_text">Login with Facebook</span> 
      </a> 
     </div> 
     ... 

だ誰もが、私の手をしてください与えることはできますか?おかげさまで

答えて

1

POSTリクエストパラメータが間違っています。 作業コード:

try { 
     Connection.Response response = Jsoup.connect("http://www.gpro.net/gb/Login.asp?langCode=gb&Redirect=gpro.asp") 
       .method(Connection.Method.POST) 
       .data("textLogin", "") // username 
       .data("textPassword", "") // password 
       .data("Logon", "Login") 
       .execute(); 

     System.out.println(response.body()); 
     System.out.println(response.cookies()); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 
+0

ありがとうございました!!! – Barbaroto

関連する問題