Android Question Log in to Webpage without WebView

mangojack

Expert
Licensed User
Longtime User
Have searched to no avail .. I am currently logging in to a webpage successfully using Webview.
B4X:
WebExtras1.executeJavascript(WebView1, Javascript)
But I now need this to happen from within a Service, so a webview is not an option.
Is there another method available .. HTTPClient ect .. which would be good as I will be parsing the page when loaded.

Many Thanks
 

mangojack

Expert
Licensed User
Longtime User
Ok .. at a complete loss how this works .. As I stated above , can successfully log in to a webpage using WebView.
B4X:
Dim Javascript As String
Javascript="document.forms.login_form.login.value='abcdef@email.com';" _"document.forms.login_form.password.value='ABC123'document.forms.login_form.submit();"
WebExtras1.executeJavascript(WebView1, Javascript)


I have now tried all forms of posting a string using HttpUtils2 and utilizing Firebird to view/study the webpage (without really knowing what I'm looking for)
B4X:
 job1.PostString("https://www.lotterywest.wa.gov.au/play-online/@@player-login", "document.forms.login_form.login.value=abcdef@email.com" & "document.forms.login_form.password.value='ABC123" & "document.forms.login_form.submit")
   
'another attempt ...
job1.PostString("https://www.lotterywest.wa.gov.au/play-online/@@player-login", "$login.val=abcdef@email.com" & "$pword.val=ABC123" & "$(Login_Form).submit()")

Or is there more to it that this ..

Many Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to send a POST request. You can see the payload string here (under Source):

SS-2014-06-19_08.26.01.png
 
Upvote 0
Top