Introduction How to Use Buy Support More ActiveX Site Home

ActiveHTTP - Usage Example: GET


This example reads the root Web page of news.xxxxxxx.com --- http://news.xxxxxxx.com/


var hr=new ActiveXObject("ActiveHTTP.Request");
hr.Start("GET", "/");
hr.AddHeader("Accept",  "*/*")
hr.AddHeader("Accept-Language",  "en-us");
hr.AddHeader("Accept-Encoding",  "gzip, deflate");
hr.AddHeader("User-Agent",  "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
hr.AddHeader("Host",  "news.eastday.com");
hr.AddHeader("Connection",  "Keep-Alive");
var r=hr.Send("news.xxxxxxx.com");
WScript.Echo("Return Value"+r.toString()+"\n");
if(r>0)
    {
    WScript.Echo(hr.GetResponseHeader());
    if(r==200)
        {
        hr.CopyResponseContent("e:\\temp\\resp.txt");
        }
    }
hr.Reset();