View Full Version : How to scrape an entire web page
nature
04-07-2004, 06:57 AM
How can I use MSXML to scrape an entire web page and then insert that into the body of an email using asp.net?
Scott
04-07-2004, 07:39 AM
I think the following will probably give you what you need:
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
sub ScrapeANdSendPage()
dim URL2Scrape As String = "http://www.blahblah.blah"
dim objWebClient as New WebClient()
dim objUTF8 as New UTF8Encoding()
dim intStartObits As Integer
dim intEndObits As Integer
dim msg As String
try
msg = objUTF8.GetString(objWebClient.DownloadData(URL2Sc rape))
catch
'-- error code here
end try
mailMessage.From = "from address here....."
mailMessage.To = "to address here....."
mailMessage.Subject = "subject here....."
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
mailMessage.Body = msg
System.Web.Mail.SmtpMail.SmtpServer = "smtp server....."
System.Web.Mail.SmtpMail.Send(mailMessage)
end sub
</script>
vBulletin® ©Jelsoft Enterprises Ltd.