Android Question Reading some value from html page

ThePuiu

Active Member
Licensed User
Longtime User
I tried to read page with HttpJob
B4X:
Dim job As HttpJob
job.Initialize("GetHTML", Me)
job.download("http://86.34.188.179:2347/")

and the result in JobDone is:
<html><head>
<title>1WireAgent</title>
<link rel="stylesheet" type="text/css" href="c.css" />
<script type="text/javascript" src="j.js"></script>
</head><body onLoad="timer();setInterval(function () {timer()}, 1000);">
<div id="w"><div id="c">
<div id="t"><center><img src="logo.png" alt="" /><br>1WireAgent</center></div>
<form name="SNMPTA">
<h2>Monitored Data</h2>
<br>
<fieldset>
<legend>1Wire Devices</legend>
<br>
<fieldset>
<legend>Greutate Stup</legend>
<div class="s">
<div class="l">ADC</div>
<span id="g01"></span></div>
</fieldset><br>
<fieldset>
<legend>Temperatura</legend>
<div class="s">
<div class="l">Temperature</div>
<span id="v02"></span>&nbsp;&deg;C</div>
</fieldset><br>
<fieldset>
<legend>Info</legend>
<div class="s">
<div class="l">Config Port</div>8080</div>
<div class="s">
<div class="l">Firmware</div><span id="SysDescr"></span></div>
</fieldset>
<br>
<center><a href="http://www.microelemente.ro/">(c)2014 www.microelemente.ro</a></center>
<br>
<center><a href="http://www.mozilla.com/firefox/">Recommended with Mozilla Firefox</a></center>
</form></div></div>
</body></html>

but the value of temperature is not in there.... Is something wrong in what I'm doing?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You are not doing anything wrong, the issue is that the value for the temperature seems to be handled by the JavaScript, like I mentioned on my previous post, scraping is not recommended, now you see why.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I tried to read page with HttpJob
B4X:
Dim job As HttpJob
job.Initialize("GetHTML", Me)
job.download("http://86.34.188.179:2347/")

The values are written to html-code after page downloading by a javascript. This reads the file v.txt and then the values are updated in html...

Try downloading
B4X:
Dim job As HttpJob
job.Initialize("GetHTML", Me)
job.download("http://86.34.188.179:2347/v.txt")
[/quote]
 
Upvote 0
Top