Grabbing certain HTML from a webpage via code

jmes
11-11-2004, 10:49 AM
Pat,
While searching the forum, I came across your thread. I am trying to do something similar. I would like to simply save the web page, don't really care if it is text or html AND if given an image path, would like to save the image to a local file. (i.e. http://PATH...../image.jpg)

I've tried the web browser object, but that doesn't seem to allow me to save the file (in any form). If you could point me in the right direction to capture the html programmatically, that would be great. Any help on the image file would also be appreciated.

Thanks in advance,

Jim





I'm able to capture a webpage to a .txt file, but I'd like to be able to grab specific data out of the file.

Specifically, I want to capture everything beginning with:


<table cellspacing=0 cellpadding=0 border=0 width=400>


and ending with


</table>


I'd also like to strip all <IMG ..... > calls from within those chunks.

Two quick questions, (1) should I use regular expressions to accomplish the above? (2) Do I need to save the file to a temp .txt to do this, or can I store the webpage as a string variable and then parse the above without storing the file first?

Thanks for the help,

Pat

excaliber
11-27-2004, 11:43 AM
Look up the HTTPWebRequest object and HTTPWebResponse object. That will give you (easily) the HTML from a page.

EDIT: On second thought, a WebClient would probably be easier to use/set up:

http://www.xtremevbtalk.com/showthread.php?t=192940

potman_100
12-17-2004, 06:51 PM
Hi

Not to sure about the HTMLDcoument Classes in .net, but if its a s easy as VB6, then its a short learning curve.

As For Downloading


Imports System.Net


Dim wc1 As New System.Net.WebClient

dim url_to_check, file_to_save_to as string

url_to_check = "File You Want To Download"
file_to_save_to = "Local File"


wc1.DownloadFile(url_to_check, file_to_save_to)
wc1 = Nothing



Regards

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum