RosettaCodeData/Task/Web-scraping/BBC-BASIC/web-scraping.basic

19 lines
612 B
Plaintext

SYS "LoadLibrary", "URLMON.DLL" TO urlmon%
SYS "GetProcAddress", urlmon%, "URLDownloadToFileA" TO UDTF%
SYS "LoadLibrary", "WININET.DLL" TO wininet%
SYS "GetProcAddress", wininet%, "DeleteUrlCacheEntryA" TO DUCE%
url$ = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
file$ = @tmp$+"navytime.txt"
SYS DUCE%, url$
SYS UDTF%, 0, url$, file$, 0, 0 TO result%
IF result% ERROR 100, "Download failed"
file% = OPENIN(file$)
REPEAT
text$ = GET$#file%
IF INSTR(text$, "UTC") PRINT MID$(text$, 5)
UNTIL EOF#file%
CLOSE #file%