Downloading all images in a page
2006-05May-26
The following code receives a reference to IE or the web browser control. The code loops through all IMG tags and downloads those that have a picture associated with it. If you also retrieve the text ofa web page, you can store all the content of the page.
Lparameters toWeb
Local loImg, lnImg
DECLARE INTEGER URLDownloadToFile IN urlmon Long, STRING, ;
STRING, Long, Long
loImg = toWeb.Document.getElementsByTagName("img")
For lnImg=0 to loImg.Length-1
If not Empty(loImg.item(m.lnImg).Src)
URLDownloadToFile( ;
0, ;
loImg.item(m.lnImg).Src, ;
"img"+Transform(m.lnImg)+"."+;
JustExt(loImg.item(m.lnImg).Src), ;
0, 0 ;
)
EndIf
EndFor