Programming in JavaScript
Top  Previous  Next

The HTTPAnalyzer automation library is packaged as an OLE automation object. JScript (Microsoft's version of JavaScript) is a loosely-typed language. In other words, variables aren't explicitly declared as specific data types. You cannot declare a variable as a specific type of object, so early binding is not possible in JScript. JScript's ActiveXObject() constructor function is used to create a late binding interface to an OLE Automation object.Once an object is created, you refer to it in code using the object variable you defined.

Access HTTPAnalyzer Stand-alone automation library.
The IHTTPAnalyzerStandAlone object is used to control the HTTPAnalyzer Stand-alone. You can attach HTTPAnalyzerStandalone into a specific process or user/session/system wide.

var httpAnalyzer=new ActiveXObject("HTTPAnalyzerStd.HTTPAnalyzerStandAlone");

httpAnalyzer.AttachProcessByName("cscript.exe"
);//attach to javascript process
httpAnalyzer.Visible=false;
httpAnalyzer.Start();
......
httpAnalyzer.Stop();

for (var index = 0
; index < httpAnalyzer.Log.Count; ++index )
{
  var entry = httpAnalyzer.Log.Item(index);
  WScript.Echo(entry.URL);
  entry.Request;//get request

  entry.Response;//get response

  entry.Content;//get reqest content.


  //do something

}



Access HTTPAnalyzer IE Add-on automation library.
The IHTTPAnalyzerAddOn object is used to control the HTTPAnalyzer IE Add-on.

var addon=new ActiveXObject("IEHTTPAnalyzer.HTTPAnalyzerAddOn");
addon.start();
addon.NavigateAndWait("http://www.ieinspector.com"
, -1);// infinite timeout
addon.Stop();

for (var index = 0
; index < addon.Log.Count; ++index )
{
   var entry = addon.Log.Item(index);
   WScript.Echo(entry.URL);

   entry.Request;//get request

   entry.Response;//get response

   entry.Content;//get reqest content.

   //do something

}



Access HTTPAnalyzer Firefox Add-on automation library.
The IHTTPAnalyzerFirefox object is used to control the HTTPAnalyzer Firefox Add-on.

var addon=new ActiveXObject("HTTPAnalyzerFF.HttpAnalyzerFirefox");
addon.start();
addon.NavigateAndWait("http://www.ieinspector.com"
, -1);// infinite timeout
addon.Stop();

for (var index = 0
; index < addon.Log.Count; ++index )
{
   var entry = addon.Log.Item(index);
   WScript.Echo(entry.URL);

   entry.Request;//get request

   entry.Response;//get response

   entry.Content;//get reqest content.

   //do something

}