Is it possible on VBScript to get text from a web page or from a txt file on a network? If not difficult, please provide the code. (the VBS file itself is running on the computer)

    1 answer 1

    To get data from the HTTP server, you need to send a GET request there. This can be done in many ways, for example:

    Dim o Set o = CreateObject("MSXML2.XMLHTTP") o.open "GET", "http://www.example.com", False o.send 

    Now inside o.responseText contains the response of the server having the data type String. Do what you want with it (parse, save as a file, re-send it to another place). The Orthodox documentation on MSXML2.XMLHTTP is here.

    • Sorry, but what is the response from the server? (There is the whole file or something else) - glarionenko
    • Corrected a bit. o.responseText - server response. - igumnov
    • And why this procedure does not want to be repeated several times in a cycle? - glarionenko
    • Dim o Dim x Dim b Do Set o = CreateObject ("MSXML2.XMLHTTP") o.open "GET", "http: //.../message.txt", False o.send b = o.responseText If x <> b Then MsgBox (o.responseText) x = b End If WScript.Sleep 1000 Loop WScript.Quit - glarionenko