Android Question HttpUtils2 error 403

magarcan

Active Member
Licensed User
Longtime User
Hi! I'm using HttpUtils2 for downloading html file of a site.
Uri is similar to this: https://www.b4x.com The problem is that instead of the html file, I get a different one thelling something like this:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Error 403 Keep Honking</title>
  </head>
  <body>
    <hr><h1>Keep Honking</h1>
    <hr>...
  </body>
</html>
        
Keep Honking

I've tried adding index.htm, index.html, index.php to the uri, but I get error 404 instead.

Any idea?
 

magarcan

Active Member
Licensed User
Longtime User
I've just needed to add this:
B4X:
req.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko") 'Without this line it will fail (FORBIDDEN error)
 
Upvote 0
Top