Function getHtmlFromUrl(pURL As String) As String
Dim resText As String
Dim objHttp As Object
Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
objHttp.Open "GET", pURL, False
objHttp.Send ""
getHtmlFromUrl = Mid(objHttp.ResponseText, 1, 255)
End Function
Hi Valentin,
You could have a cell with the URL i.e. http://www.somesite.com
Use a function to get the HTML from URL
Code:Function getHtmlFromUrl(pURL As String) As String Dim resText As String Dim objHttp As Object Set objHttp = CreateObject("MSXML2.ServerXMLHTTP") objHttp.Open "GET", pURL, False objHttp.Send "" getHtmlFromUrl = Mid(objHttp.ResponseText, 1, 255) End Function
Is the function getHtmlFromUrl returns an error then site is offline
If you get a string starting with <!doctype html> <html...<HTML<HTML..." online
cheers
Sergio</HTML<HTML...">
' Function declares a user defined function that you can use from a cell like
' if you write =getHtmlFromUrl("http://www.yoursite.com/samepage.html") in B2
' or you write =getHtmlFromUrl(A3) in B3 and A3 has ="http://www.yoursite.com/samepage.html"
' here pURL is the parameter where the URL string is stored
Function getHtmlFromUrl(pURL As String) As String
' Creates a variable resText I think I am not using this
Dim resText As String
' Creates a variable objHttp to store a very small internet browser
Dim objHttp As Object
' Creates the browser and stores it in the variable
Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
' Uses the browser to navigate to the page
objHttp.Open "GET", pURL, False
objHttp.Send ""
' fetches the page into the variable getHtmlFromUrl that is what the cell gets
getHtmlFromUrl = Mid(objHttp.ResponseText, 1, 255)
End Function