October 17, 2021, 10:14:17

Author Topic: [bb] HTML WEB READER BMX by warwulf [ 1+ years ago ]  (Read 1440 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] HTML WEB READER BMX by warwulf [ 1+ years ago ]
« on: June 29, 2017, 00:28:43 »
Title : HTML WEB READER BMX
Author : warwulf
Posted : 1+ years ago

Description : this reads html code from a website

Code :
Code: BlitzBasic
  1. HTTPReader("www.blitzbasic.com")
  2. Function HTTPReader$(url$)
  3.         Local stream:TStream = OpenStream("http::" + url$,80)
  4.         If Not stream Then Return -1
  5.         stream.WriteLine "HEAD " + file$ + " HTTP/1.1"
  6.         stream.WriteLine "Host: " + host$
  7.         While Not Eof(stream) ; Print stream.ReadLine() ; Wend
  8.         stream.Close()
  9.         Return header$
  10. End Function


Comments :


Gauge(Posted 1+ years ago)

 In this example what would file$ and host$ be?


xlsior(Posted 1+ years ago)

 I'd assume the following, based on the HTTP specs:Host would be the hostname of the website (e.g. "www.blitzbasic.com" -- this is what the server uses to detect the website you want, since under HTTP1.1 multiple sites can share a single IP address)file would contain the path+filename, e.g. "codearcs/codearcs.php"If you do NOT know a file/folder name and simply want to go to the default main page of a site, specify "/" as the filename, which will tell it to open the default document in the root folder of the website.


Brucey(Posted 1+ years ago)

 It's basically a really bad, incomplete example of doing something. There are probably better examples elsewhere.


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal