[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

download html to computer for process

Posted on 2002-06-23
18
Medium Priority
?
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 800 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 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