473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to grab html code from remote website?

How to grab html code from remote website?
can someone help?
please let me know...
vjay

Nov 21 '05 #1
2 1880
Here's a function I wrote for what you're asking, if I understand you.
For this to work you need Imports System.Net and Imports System.IO.

Public Function GetSource(ByVal URL As String) As String

Dim vSource As String = ""
Dim HTTPRequest As HttpWebRequest
Dim vURL As Uri
Dim sr As StreamReader
Dim Ln As String
Dim rs As HttpWebResponse
Dim inStr As Stream
Dim line As String
Dim bodyReader As StreamReader

vURL = New Uri(URL)
HTTPRequest = WebRequest.Create(URL)
HTTPRequest.AllowAutoRedirect = True
HTTPRequest.MaximumAutomaticRedirections = 10
HTTPRequest.Method = "GET"
HTTPRequest.ProtocolVersion = New Version(1, 0)
HTTPRequest.Timeout = New TimeSpan(0, 0, 30).TotalMilliseconds
HTTPRequest.UserAgent = "Mozilla/3.0 (compatible; Enigmatic/1.0)"

rs = HTTPRequest.GetResponse()
vURL = rs.ResponseUri
inStr = rs.GetResponseStream()

If Not (inStr) Is Nothing Then
bodyReader = New StreamReader(inStr)
line = bodyReader.ReadLine()
Do While (line) Is Nothing = False
vSource &= line & vbCrLf
line = bodyReader.ReadLine()
Loop
bodyReader.Close()
bodyReader = Nothing
End If

rs.Close()
rs = Nothing
HTTPRequest = Nothing
Return vSource

End Function

Vjay77 wrote:
How to grab html code from remote website?
can someone help?
please let me know...
vjay


--

Confucious say: "He who stands on toilet is high on pot."
Nov 21 '05 #2
Excellent,Thanks a lot for your time.
VJAY

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Baby Blue | last post by:
I have 2 code like below to grab a news website for my site. However, when I click some links (such as : http://wwww.vnexpress.net/xxx/xxxx ) inside the site which I want to grab, it has some...
4
by: jason | last post by:
I would appreciate some help on how to convert a database table into an html file via FSO and whether more seasoned asp programmers recommned this route. The main reason I am attempting to do this...
3
by: James | last post by:
Hi guys, I have been building a search engine here - not because I have plans of dethrowning Google but as a simple app upon which to develop a function set that I can use for other things. ...
36
by: sonnystarks | last post by:
I am trying to learn HTML and have obtained several books on the subject. However, I am confused with the proper way of going about it as most of these books give me the basic tags and then say...
4
by: musosdev | last post by:
Hi peeps I've just moved my dev system to Win2k3 / VS2005 (from Win2k/VS2k3) and I'm having a problem. I've setup a new website in IIS, enabled .net, fpse, etc. From VS2005, if I choose...
8
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the...
2
by: Dabbler | last post by:
Is there a way I can manage a remote website (virtual shared hosting service) with WAT? When I run it from the VWD Express it opens my local sites but I'n not sure how to invoke it against a remote...
3
by: Nymus | last post by:
I would like to use an access database as a shared database on a remote website. I don't know if it is possible, but this is what i would like to do with this database: - Use it to run a database...
3
by: zac540 | last post by:
Hey everyone! First of all I'd like to say that I did my best to look for any other relevant posts. The best I found was this interesting thread.. http://bytes.com/forum/thread594982.html If...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.