Task

Access and print a URL's content (the located resource) to the console.

There is a separate task for HTTPS Requests.




 
InitNetwork()
OpenConsole()
 
tmpdir$   = GetTemporaryDirectory()
filename$ = tmpdir$ + "PB_tempfile" + Str(Random(200000)) + ".html"
 
If ReceiveHTTPFile("http://rosettacode.org/wiki/Main_Page", filename$)
  If ReadFile(1, filename$)
    Repeat
      PrintN(ReadString(1))
    Until Eof(1)
    Input()
    ; to prevent console from closing if on windows
    CloseFile(1)
  EndIf
  DeleteFile(filename$)
EndIf
 