HTTP GET Request, ASP - I'm Lost!

Using VBScript with ASP, I am trying to configure an HTTP GET Request that will visit a page, which in turn generates an ASCII string (not HTML). Then I want to extrapolate this ASCII string, which will have 4 values ​​separated by a semicolon, into 4 variables on my ASP source page so that I can accept these values ​​and do something with them.

This is the page I want to access with the HTTP GET Request http://www.certigo.com/demo/request.asp . Here, the three values ​​are zero.

I don't know much / anything about ASP, so I have this:

Dim oXMLHTTP Dim strStatusTest Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0") oXMLHTTP.Open "GET", "http://www.certigo.com/demo/request.asp", False oXMLHTTP.Send If oXMLHTTP.Status = 200 Then strStatusText = oXMLHTTP.responseBody End If 

but obviously I don’t know what I am doing, because it doesn’t work at all. I would not be completely surprised to learn that what I have here is not going in the right direction. Please, help!

-Tracy

+8
get vbscript asp-classic request
source share
2 answers

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 the use of ServerXMLHTTP from ASP, the XMLHTTP component is intended to be used on the client side and is unsafe for use in a multi-threaded environment such as ASP.

+19
source

Try changing oXMLHTTP.responseBody to oXMLHTTP.responseText and see if this works.

Refer to this web page if you need more information about this technique:

http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html .

0
source

Source: https://habr.com/ru/post/639901/


All Articles