How to Read an Internet File

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
 
T

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
 
D

Dirk Goldgar

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
 
S

SRCatAIS

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
 
F

Fred Boer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top