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."