So I've been at this for a while. I've found ways to do it using Visual Studio code. Here's an example of my favorite function:
Code:
Public Function DownloadHTMLPage(ByVal _URL As String) As String
' <summary>
'Function to download HTML web page
' </summary>
' <param name="_URL">URL address to download web page</param>
' <returns>HTML contents as a string</returns>
Dim _PageContent As String = Nothing
Try
' Open a connection
Dim _HttpWebRequest As System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create(_URL), System.Net.HttpWebRequest)
' You can also specify additional header values like the user agent or the referer: (Optional)
_HttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)"
_HttpWebRequest.Referer = "http://www.google.com/"
' set timeout for 10 seconds (Optional)
_HttpWebRequest.Timeout = 10000
' Request response:
Dim _WebResponse As System.Net.WebResponse = _HttpWebRequest.GetResponse()
' Open data stream:
Dim _WebStream As System.IO.Stream = _WebResponse.GetResponseStream()
' Create reader object:
Dim _StreamReader As New System.IO.StreamReader(_WebStream)
' Read the entire stream content:
_PageContent = _StreamReader.ReadToEnd()
' Cleanup
_StreamReader.Close()
_WebStream.Close()
_WebResponse.Close()
Catch _Exception As Exception
' Error
Console.WriteLine("Exception caught in process: {0}", _Exception.ToString())
Return Nothing
End Try
Return _PageContent
End Function
This works great, but I can only use it in a full blown VB Application. What I'd really like to do is get this same functionality in access. All I need is to be able to pull the source code of a given website.
Access VB doesn't seem to have all that good "System" stuff.
Is there any way to get that into an access DB so I can use this function?
Is there a simpler way to get a websites source code that could be used in access?
Thanks