B4J Question How to know URL of jobdone/getrequest data in httputils

kostefar

Active Member
Licensed User
Longtime User
Dear All,

Followup on https://www.b4x.com/android/forum/t...-from-website-with-webview.94415/#post-597488:

If you use httputils to get the content of a page which automatically forwards to another one, is there a way to get the URL of the page that it´s forwarding to? Of course you can scrape getrequest and be lucky to find it, if you know all forwarding methods, but if you don´t, or if the page is encrypted, how would you be able to find out which URL that you´re being sent to programatically?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Update to v2.70: https://www.b4x.com/android/forum/threads/updates-to-internal-libaries.48274/#content

B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("http://www.b4x.com")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
   Dim jo As JavaObject = j.Response
   Dim RedirectedRequest As JavaObject = jo.GetFieldJO("response").RunMethod("request", Null)
   Dim url As String = RedirectedRequest.RunMethod("url", Null)
   Log(url)
End If
j.Release
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User

Awesome Erel, thanks so much!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…