Forum Discussion
joker6413
16 years agoOccasional Contributor
Final version of script:
function HttpGet(url, userAgent)
{
var httpObj = Sys.OleObject("MSXML2.XMLHTTP");
httpObj.open("GET", url, true);
httpObj.setRequestHeader("User-Agent", userAgent); // set user agent
httpObj.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); /// do not cache the response
httpObj.send();
while((httpObj.readyState != 4) && (httpObj.readyState != 'complete'))
{
Delay(300);
}
switch(httpObj.status)
{
case 200:
case 302:
if (httpObj.responseText.lenght == 0) //!= expectedObjectData)
{
Log.Message("The " + link + " link is valid", httpObj.responseText);
return false;
}
return httpObj.responseText;
break;
default:
Log.Message("The " + link + " link was not found, the returned status: " +
httpObj.status, httpObj.responseText);
return false;
}
}
function HttpGet(url, userAgent)
{
var httpObj = Sys.OleObject("MSXML2.XMLHTTP");
httpObj.open("GET", url, true);
httpObj.setRequestHeader("User-Agent", userAgent); // set user agent
httpObj.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); /// do not cache the response
httpObj.send();
while((httpObj.readyState != 4) && (httpObj.readyState != 'complete'))
{
Delay(300);
}
switch(httpObj.status)
{
case 200:
case 302:
if (httpObj.responseText.lenght == 0) //!= expectedObjectData)
{
Log.Message("The " + link + " link is valid", httpObj.responseText);
return false;
}
return httpObj.responseText;
break;
default:
Log.Message("The " + link + " link was not found, the returned status: " +
httpObj.status, httpObj.responseText);
return false;
}
}