How to Read an Internet File

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

Chaplain Doug said:
I want to programmatically open a file on the internet and
read its HTML, line by line. When I try for instance:

Open "http://mywebpages.comcast.net/dpruiett/index.html"
For Input As #1
I get an "Bad file name or number" error. Can anyone help
me to accomplish what I am aiming for? Thanks.


Nice try - but *definitely* no banana that way!

Perhaps look ino the microsoft WebBrowser control. You drop that control on
your page, then use its .Navigate method to open the URL that you want.

Understand that HTML is not really a line oriented language. Parsing HTML is
way more complicated than reading it in "line by line". The HTML that a
website gave you today, comprising 50 lines of HTML, might be delivered in
40 lines tomorrow, and 85 lines the day afterwards!

HTH,
TC
 
SRCatAIS said:
Doug,
You must use the activex control, Microsoft Internet Control, found in
the toolbox. This or the Microsoft Web Brower control can be directed to a
website. It will also give you access to the DOM. You can then extract the
document and read line by line. I have an app at the office that does this.
You can email me (e-mail address removed) if you would like the code.
Steven Cummings MCSE


He doesn't >must< hafta! He could do a few winsock calls (WSOCK32.DLL) to
send an HTTP request!

Do you know if there is any way to access the DOM *without* the webbrowser
control? I have HTML, & need to access the DOM, but I absolutely do not
want to inconporate the webbrowser control.

TIA,
TC
 
Chaplain Doug said:
I want to programmatically open a file on the internet and
read its HTML, line by line. When I try for instance:

Open "http://mywebpages.comcast.net/dpruiett/index.html"
For Input As #1

I get an "Bad file name or number" error. Can anyone help
me to accomplish what I am aiming for? Thanks.

You can't really do it like that. You *may* be able to do line-by-line
access using calls to the Windows API, but I don't know much about that.
How about downloading the whole web page into a string variable, which
you could then parse to get the individual lines? You can do that using
the classes supplied by the InetTransferLib, downloadable here:

http://www.mvps.org/access/modules/mdl0037.htm
 
Doug
You must use the activex control, Microsoft Internet Control, found in the toolbox. This or the Microsoft Web Brower control can be directed to a website. It will also give you access to the DOM. You can then extract the document and read line by line. I have an app at the office that does this. You can email me (e-mail address removed) if you would like the code

Steven Cummings MCSE
 
Every time I see "Dev Ashish", my brain turns it into "Devilish"... And when
I see a Chaplain saying that the Devilish stuff did the trick, well... it
gave me a start! <g>


Best Wishes!
Fred Boer
 
Back
Top