开发者

vbs script to send data and repeat

Does anyone have sample VBS code that se开发者_开发知识库nds a variable, waits response and repeat?

i have so far:

dim input 
input = Inputbox ("Enter Var:" ,"Var sender...") 

SourceURL = "http://example.com/someFunction.php?var="&input&""

that's it... my other code is not functional...

thanks in advance, hope anyone can help, totally lost in vbs... in windows in general...


Assuming that this is Windows Script Host, you can use the MSXML2 library.

do while true

    Dim input, SourceURL 
    input = Inputbox ("Enter Var:" ,"Var sender...") 

    SourceURL = "http://www.google.co.uk/search?q=" & input
    ''// connect and send to server
    Dim http: set http = CreateObject("MSXML2.XMLHTTP") 
    http.open "GET", SourceURL, false
    http.send

    if http.status = 200 then
        ''// do something with the return value if necessary 
         WScript.Echo http.responseText
    else
        ''// problem? 
    end if
    ''// pause execution if you don't want to hit the server so often
    WScript.Sleep 10 
loop

if you're modifying things on the server, you should probably use a POST request instead of a GET request, but this should work if your server side script only accepts GET requests

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜