Hej,
Jag håller på att sliter mitt hår just nu. Hur fasen får man ServerXMLHTTP att fungera. Det jag vill åstakomma är att hämta en hel websida från en webserver och sedan visa koden (och så småningom analysera den).
Problemen som uppstår är allt från att servern returnerar header 501, 404 och ibland fungerar det. Något är uppenbarligen fel. Är det någon som har fått detta att fungera?
'1) - GET PAGE FROM WEBSERVER...
'http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html
'http://www.topxml.com/parsers/sniffer/default.asp
Dim xmlhttp
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
' Indicate that page that will receive the request and the type of request being submitted
xmlhttp.Open "Get", iUrl, False
' Indicate that the body of the request contains form data
'xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' Send the data as name/value pairs
xmlhttp.send ""
'response.write(xmlhttp.responseText)
' Test errors
if err.number <> 0 then
response.write "Error: " & xmlhttp.parseError.URL & _
"<br>" & xmlhttp.parseError.Reason
response.end
end if
'Display the HTML both as HTML and as text
' Response.Write "<h1>The HTML text</h1><xmp>"
' Response.Write xml.responseText
' Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"
' Response.Write xml.responseText
varPageSource = xmlhttp.responseText
Om 501: http://www.checkupdown.com/status/E501.html
Jag förstår inte alls. Antar att mitt anrop till webservern är inkorrekt.
:stud