Solved

download html to computer for process

Posted on 2002-06-23
18
193 Views
Last Modified: 2010-05-02
I am a newbie of VB. I want to write a program that:

First, download some html pages from a certain site(which is generated by CGI) to a specified directory

Then, open the html file and do the processing.

Finally, save the list of processed data into a spread sheet file and delete the original html file

Can you tell me how to do the download step and the open file step?

thanks
0
Comment
Question by:leekf
  • 6
  • 6
  • 3
  • +1
18 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7101480
Hi leekf,

Is that spreadsheet Excel?

if so there's an easier way

:O)Bruintje
0
 
LVL 8

Accepted Solution

by:
glass_cookie earned 200 total points
ID: 7101494
Hi!

Maybe you'd like to try using the INet control to download pages onto your PC:

Download...
http://www.vb-helper.com/HowTo/inetgetchunk.zip
Description: Use the Internet Transfer Control's Execute method and GetChunk to download a file (3K)

That's it!

glass cookie : )
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7101497
Here's a last one:

Download...
http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=21636&strZipAccessCode=ODE%5F216366631
Description: A Complete Multi Downloader (using multithreads)

That's it!

glass cookie : )
0
 
LVL 2

Author Comment

by:leekf
ID: 7101581
thanks... really cool

but after I downloaded a html file using the Multi Downloader, what is the code to open it so that I can edit it?
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7101600
still wondering is this in excel or not?
0
 
LVL 2

Author Comment

by:leekf
ID: 7101634
thanks... really cool

but after I downloaded a html file using the Multi Downloader, what is the code to open it so that I can edit it?
0
 
LVL 2

Author Comment

by:leekf
ID: 7101637
o... in fact, there is no need to be excel... even text file will be ok... thanks
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7102015
Ypu could open the resukting html file just like any other plain file:
dim strContents as string
Open "c:\somefile.htm" for input as 1
   strContents =input(lof(1),1)
close

' do what you want with strContents
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7102089
LOL, glued your keys together Richie ;)
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 2

Author Comment

by:leekf
ID: 7102512
... sorry.. i miss out something in my question...

i also want to know how to fetch all the URL and email address that contain in the html file

thanks
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7102548
Hi!

You could use the instr() method to find the position in the text (after opening the file) where a "http://" exists.  From there, you cou;d just simply use the mid function to get the string.  In other words:

1. Use the instr function to determine where the "http" lies.
2. Use the instr method to find ".htm" or ".html" to determine the end of an address starting from the position of the 1st character of the "http://"

Sorry - no time to code them for you.  Let me know if you need me to code it for you : )  I'll probably do it tomorrow or some days later when I'm free : )

Use the mid function to retrieve the address from the difference in positions in the 1st and last characters.

That's it!

glass cookie : )
0
 
LVL 2

Author Comment

by:leekf
ID: 7102562
thanks... i have tried this method before...

Private Sub newprocess_Click()
Dim unprocess0, endvalue As String
Dim inresult1, inresult2, i As Integer
Dim result(100) As String

unprocess0 = txtResults.Text
For i = 1 To 100

inresult1 = InStr(unprocess0, "http://")
unprocess0 = Mid(unprocess0, inresult1 + 7, Len(unprocess0))
endvalue = "/"

inresult2 = InStr(unprocess0, endvalue)
result(i) = Left(unprocess0, inresult2 - 1)

List1.AddItem result(i)

Next i


End Sub


but there are some ugly URL in the list. i think the endvalue = "/" has problem. How to replace it?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7104292
I am not a good typist, i know ;)
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7106470
Could you post a sample of the file you're opening so that I can have a clearer picture?  I'm not very sure how those urls are 'embedded' in the file.  Thanks : )
0
 
LVL 2

Author Comment

by:leekf
ID: 7106690
just like any html code, eg:

<a href="http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp" class="eeTopLink">Help Desk</a>
<a href="http://www.experts-exchange.com/jsp/cmtyHelpDeskKp.jsp" class="eeTopLink">KPro Help</a>

so... how to get the URL in this kind of file?
how to determine the end of an address?
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7106904
Hi!

OK, simply look for a "http:// to start with and look for another " which indicates it's end through the instr() function.  In VB, they are:

i = instr(1,text1.text,"""http://")

and

instr(i+1,text1.text,"""")

That's it!

glass cookie : )
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7108594
You could use HTML object library and avoid using plain text. There are collections for almost everything.
If you need to enumerate hyperlinks for a given page, take a look at wwww.angelfire.com/realm/vb-shared/index.html under "IE DOM..." topic.
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7120958
Thanks for the points  : )
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now