lundi 11 mai 2015

How to call an URL again and again

This is my code for calling URL

@if (@This==@IsBatch) @then
@echo off


    setlocal enableextensions disabledelayedexpansion



        wscript //E:JScript "%~dpnx0" "http://abcd.com/xyz=lo" 



    exit /b

@end

var http = WScript.CreateObject('Msxml2.XMLHTTP.6.0');


var url = WScript.Arguments.Item(0)



    http.open("GET", url, false);
    http.send();


    WScript.Quit(0);

This calls the url http://abcd.com/xyz=lo only once

Now I wanted to call the URL if the reponse code is 200 so I did like this

:loop
    http.open("GET", url, false);
    http.send();

if(http.status==200)
{

}
else
{
goto loop
}

But its not working(its not calling the url even if the status is 400)

Aucun commentaire:

Enregistrer un commentaire