Read webpage - MSXML2.ServerXMLHTTP
I have the following VBA script, put together from various sources (mainly zoho forum/help/support, so it once worked, I guess):
- private Sub GetListOfSheets()
Dim url As String
Dim xmlhttp As Object
Dim parameters As String
Dim html As String
range("B1").value = "111"
parameters = "&isdebug=true" 'if you need some keys and values to submit
'url = "https://www.imdb.com/title/tt1386691"
url = "https://www.google.com"
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open("POST", url, false)
xmlhttp.SetRequestHeader ("Content-type", "application/x-www-form-urlencoded")
'xmlhttp.Send(parameters)
xmlhttp.Send
html = xmlhttp.responseText
'Msgbox(xmlhttp.Status)
'MsgBox "started" 'just for feedback
range("B2").value = "222222"
range("B3").value = html
'MsgBox html
Set xmlhttp = Nothing
range("B4").value = "333"
End Sub
There were numerous versions of this code, but it never worked.
What I'm trying to do: download an webpage source (imdb movie page actually) and extract title (I know how to do that).
It doesn't work, not with imdb, not with google, not with any other URL.
There is no error message, empty string returned.
xmlhttp.Status is always 0 (don't know if that's good or bad, I assume bad).
Thank you.