Solved

Downloading a web page...

Posted on 1998-11-20
7
155 Views
Last Modified: 2010-05-18
Does anyone know of an easy way to download a web page? I was doing: Site.text = Inet1.OpenURL(txtURL, 0) and then saving it to a file, but for some reason some web sites weren't complete.  It would grab like a random number of lines of the html code and then think it was done or something.  It didn't do that all the time, but enough that I need to find another method.
0
Comment
Question by:dokken
[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
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:KJHDI12
ID: 1445990
Try this:

Private Sub Command1_Click()

   ' ---------------------------------------------
   ' Tells Inet to connect to site and get file
   ' ---------------------------------------------
   Inet.URL = "http://www.sol.no/"
   Inet.Protocol = icHTTP
   Inet.RemoteHost = "www.sol.no"
   Inet.Execute "http://www.sol.no", "GET index.html"

End Sub

Private Sub Inet_StateChanged(ByVal State As Integer)

   ' ----------------------------------------------------
   ' State 12 happends when Inet has downloaded the page
   ' and is in the buffer
   ' ------------------------------------------------------
   If State = 12 Then
      Open "c:\index.html" For Output As #1
      Print #1, Inet.GetChunk(64000)  ' <- Size of page
      Close #1
   End If
   
End Sub


Mr. Fixit
0
 

Author Comment

by:dokken
ID: 1445991
Looks good except, I should have mentioned I don't always know what the html filename is called.  Sometimes it's just (using your example): http://www.sol.no/  is there anyway to grab the filename the web server uses as default in that case?
0
 

Author Comment

by:dokken
ID: 1445992
I just tried that one of the servers that I noticed was not saving the whole file, it's screws up just like the way I was doing it.  I don't think that Internet Control is going to work.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 2

Expert Comment

by:KJHDI12
ID: 1445993
Did you increase the Inet.GetChunk(64000) value? 64000 means 64k. Increase it to whatever maxsize you want.

When no filename is asked for it assumes it's index.html or index.htm.

Mr. Fixit
0
 

Author Comment

by:dokken
ID: 1445994
Size didn't matter, it would only get 1k... it cuts off near the top of the web page.  Maybe the Internet Control doesn't like some web server software.  If you want to play around with it, the site I found that duplicates the problem is: http://www.searchenginewatch.com
0
 
LVL 2

Accepted Solution

by:
KJHDI12 earned 40 total points
ID: 1445995

  hehe.. The solution was too easy..

Put multiple  "Print #1, Inet.GetChunk(64000)" after eachother.

One "Print #1, Inet.GetChunk(64000)" gets 2k. 2 ""Print #1, Inet.GetChunk(64000)" gets 4k etc...

Mr. Fixit


0
 

Author Comment

by:dokken
ID: 1445996
Thats strange :) but it works... thanks!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 94
MsgBox 4 76
Advice in Xamarin 21 121
Formula problem with Excel attachment 6 45
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

751 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