HTTP GET Request, ASP – I’m lost!

Your code should look like this:-

Function GetTextFromUrl(url)

  Dim oXMLHTTP
  Dim strStatusTest

  Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")

  oXMLHTTP.Open "GET", url, False
  oXMLHTTP.Send

  If oXMLHTTP.Status = 200 Then

    GetTextFromUrl = oXMLHTTP.responseText

  End If

End Function

Dim sResult : sResult = GetTextFromUrl("http://www.certigo.com/demo/request.asp")

Note use ServerXMLHTTP from within ASP, the XMLHTTP component is designed for client side usage and isn’t safe to use in the multithreaded environment such as ASP.

Leave a Comment