B4J Question [Server] Access is denied while using jar

tufanv

Expert
Licensed User
Longtime User
Hello,

I can manually visit a webpage from my browser , but when i try to use
B4X:
    Dim j As HttpJob
    j.Initialize("j2", Me)
    j.Download("https://link")

with my app , i get 403 forbidden. I need to donwload the source code of the website to get some data. But i think they somehow understand that the accessing file is jar file so they block it. Is there any way to change something with code so that i can download the source code or is it impossible ?

TY
 

billzhan

Active Member
Licensed User
Longtime User
Press F12 in the Chrome or Firefox to inspect the HTTP request.

Try to set request headers ( cookies , User-Agent, Host, session... ).


B4X:
Dim j AsHttpJob
j.Initialize("j2", Me)
j.Download("https://link")
j.GetRequest.SetHeader("cookie",cookie)
j.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…