Reading values from a web page

Blitz3D Forums/Blitz3D Programming/Reading values from a web page

Dimas(Posted 2005) [#1]
First of all, thank you to all who help me reading JPGs files from a web. Now, I have a new (and tricker?) problem. Note that I have NO IDEA of html, php, jsp and similar.

There is a web page: http://www.wwiionline.com/scripts/wwiionline/axis.jsp

In the botton, it has a info, called "Factories RDP". Well, I need to read this values in my program.

I read the previous url, but this values are not there. It seems to be some kind of variables sent by the server in realtime.

Is there a way I can read this values from my web?

Any help will be much appreciated.

If you want to see my program in action, download it at "www.ampostata.org/tracer.zip"


jfk EO-11110(Posted 2005) [#2]
I take it you are talking about the little list:

German RDP Report
Factory Output: 86% of capacity
Current RDP Cycle: 10% complete
Estimated Completion: 8d20h

Well basicly this Webpage seems to be a java servlet. You don't have to worry about it, the whole page comes as ordinary HTML code. Tho there are some scripts inside, the mentioned list is plain HTML, so yo can parse the file easily.

If you think this webpage will not alter its design every other day, you can seek for the "86%" (or whatever value it would be) by searching for the following string:


<span class="paperdefault">Factory Output: <b>

right after the <b> follows the 86% thing. for the other 2 values the recognizable strings are:
<span class="paperdefault">Current RDP Cycle: <b>
and
<span class="paperdefault">Estimated Completion: <b>

so all you have to do is download the page (you may do this the same way like the JPG, but you don't really need to save it as a file, but you could store it in an array right away)

Then parse all strings and test them if they include one of the mentioned strings. EG
s1$="<span class="+chr$(34)+"paperdefault"+chr$(34)+">Factory Output: <b>"
; define the other strings as well
; then open the tcp connection etc
while eof(stream)=0
r$=readline(stream)
if instr(r$,s1$)>0 then
 r2$=right$(r$,len(r$)-len(s1$))
 in2=instr(r2$,"</b>")
 value$=left$(r2$,in2)
 print "factory output "+ value$
endif
; search for the other strings as well...
wend
; close the tcp stream etc.

(well, not fully tested)