Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: Getting Images
User353

Posts: 3
Member Since: 10/22/01
posted October 22, 2001 2:47 AM

Hello,
 
I am using Dart web control to fetch a web page.
the page contains some images , so i want to fetch imags and save them on local machine.
 
i have written the following Vb code for getting images :-
 
''''''' VB CODE
 
Private Sub GetImages(strUrl As String)
' WebPage object to use for parsing
Dim WebAsp1 As New WebASP
Dim WebPage1 As New WebPage
 
Dim blnResult As Boolean
 
WebAsp1.Request.KeepAlive = True
WebAsp1.Timeout = 30000
 
' set request url
WebAsp1.Request.Url = strUrl
WebAsp1.Get
 
' set webpage source to html source from response
WebPage1.Source = WebAsp1.Response.Body.ReadString
 
' iterate through WebResources, be sure to set WebPage.UrlHost first
WebPage1.UrlHost = WebAsp1.Request.Url
 
For i = 1 To WebPage1.Resources.Count
 
  If WebPage1.Resources.Item(i).UrlType = resImg Then
  ' this WebResource is an image, so write to file
 
   blnResult = WebPage1.Resources(i).Get("C:\", False, 3000)
    If blnResult = True Then
       MsgBox WebPage1.Resources(i).UrlName & " successfully written to file"
    End If
  End If
Next
End Sub
 

Private Sub Command1_Click()
  Call GetImages("http://localhost/chess.htm")
End Sub

'''''''''''''''End Of CODE
 
 
Can any one help me to get images from a given web page ?
 
 
 
Prasanna.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted October 22, 2001 12:08 PM


Hi Prasanna,
I just tried your code, and it worked correctly for me.
The images should be placed in folders, synchronized with the folders they are in on the server. 
Try as the first Get parameter, "c:\WebImages" instead of "c:\", so it is easy to check for their presence. 
Do they not appear for you?
Thanks,
-ken

K M Drake
Dart Tech Support
User163

Posts: 1
Member Since: 03/23/02
posted March 23, 2002 4:21 AM

i have tried the above code but fail to get images.


can u have any idea?

sachin
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted March 25, 2002 4:00 PM


Hi sachin,
What is the Url of the page you are getting?
Thanks,
-ken

K M Drake
Dart Tech Support
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX