I need to work only with cmd functions. I need two vars / strings from a website to use in batchscript to check actions with it. In order not to make it too easy, this site needs authentication.
I found this somewhere:
@set @x=0 /*
:: ChkHTTP.cmd
@echo off
setlocal
set "URL=http://www.google.com"
cscript /nologo /e:jscript "%~f0" %URL% | find "200" > nul
if %ErrorLevel% EQU 0 (
echo Web server ok % Put your code here %
) else (
echo Web server error reported
)
goto :EOF
JScript */
var x=new ActiveXObject("Microsoft.XMLHTTP");
x.open("GET",WSH.Arguments(0));x.send();
while (x.ReadyState!=4) {WSH.Sleep(50)};
WSH.Echo(x.status)
But I’m not sure if it’s possible to get the site’s content this way, instead of responding to the status, and the more I don’t know how to implement site authentication.
The above code doesn’t work correctly, as it always causes an error due to the pipe, but this seemed closer to my needs in analyzing the content I was hoping for.