ok so i'm working on a new script that involves scraping a webpage. below is the scraping bit, along with a saveToFile function, so i can see what stuff returns.
the problem:
my xmlhttprequest is returning nothing.
the script:
code:
function OnEvent_Initialize(MessengerStart)
{
getData();
}
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
function getData()
{
xmlhttp.open("GET", "http://shoutbox.menthix.net/forumdisplay.php?fid=39", true);
xmlhttp.onreadystatechange = stateChanged;
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
saveToFile(xmlhttp.responseText);
}
else
{
saveToFile(xmlhttp.status);
}
}
}
function saveToFile(data1)
{
var fso, f1, thePath;
fso = new ActiveXObject("Scripting.FileSystemObject");
thePath = "C:\\file.txt";
f1 = fso.CreateTextFile(thePath, true);
f1.Write (data1);
f1.Close();
}
function OnEvent_Uninitialize(MessengerExit)
{
}
the script is kinda cut and pasted together from various sources, but it looks like it should work. it's returning a readystate of 4, but an http status of zero.
help me please.