Programming in Delphi
Top  Previous  Next

The HTTP Analyzer automation library is packaged as COM components. both Stand-alone and Add-on can be fully controlled from Delphi applications using OLE Automation.
To use the interface and dispinterface technologies in Delphi, we need to import HTTPAnalyzer-related type libraries.

1) Run Borland Delphi and go to Project menu. Then click Import Type Library... menu item to show Import Type Library dialog.
2) Import Type Library dialog will appear. Find the following COM libraries in the list of type libraries and click Install button.

There are three COM components related with HTTP Analyzer, namely,

HTTPAnalyzer Automation Common Library
The common library which defines most of the automation interfaces. Both Stand-alone and IE add-on editions need the library.
HTTPAnalyzer Stand-alone Automation Library
The stand-alone automation library includes the creatable object, IHTTPAnalyzerStandalone, which controls the HTTPAnalyzer Stand-alone out-proc COM server.
HTTPAnalyzer IE Add-on Library
The IE Add-on automation library includes the creatable object, IHTTPAnalyzerAddon, which controls the HTTPAnalyzer IE Add-on.
HTTPAnalyzer Firefox Add-on Library
The Firefox Add-on automation library includes the creatable object, IHTTPAnalyzerFirefox, which controls the HTTPAnalyzer Firefox Add-on.


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
  standalone:CoHTTPAnalyzerStandAlone;
  
//HTTPLogEvents: THTTPAnalyzerILogEvents;
  entry:ILogEntry;
begin
  standalone := CoHTTPAnalyzerStandAlone.Create;

  //Wire HTTPAnalyzer Events
  //HTTPLogEvents := THTTPAnalyzerILogEvents.Create(self);
  //HTTPLogEvents.OnNewEntry := DoOnNewEntry;
  //HTTPLogEvents.OnUpdateEntry := DoOnUpdateEntry;

  standalone.Visible := true;
  standalone.AttachProcessByID(GetCurrenetProcessID)
;
  standalone.Start;
    ......
  standalone.Stop;

  for i :=0
  to standalone.Log.Count-1 do
  begin
    entry:=standalone.log[i];
    entry.Request;//get request

    entry.Response;//get response

    entry.Content;//get reqest content

  
      //do something

  end;
end;



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

var
  ieaddon:THTTPAnalyzerAddon;
  
entry:ILogEntry;
begin
  ieaddon := CoHTTPAnalyzerStandAlone.Create;
  ieaddon.Start;
  ......
  ieaddon.Stop;

  for i :=0  to ieaddon.Log.Count-1
 do
  begin
    entry:=ieaddon.log[i];
    
    entry.Request;//get request

    entry.Response;//get response

    entry.Content;//get reqest content.

      //do something

  end;
end;



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

var
  ffaddon:CoHttpAnalyzerFirefox;
  
entry:ILogEntry;
begin
  ffaddon := CoHttpAnalyzerFirefox.Create;
  
  ffaddon.Start;
  ......
  ffaddon.Stop;

  for i :=0  to ffaddon.Log.Count-1
 do
  begin
    entry:=ffaddon.log[i];
    
    entry.Request;//get request

    entry.Response;//get response

    entry.Content;//get reqest content.

      //do something

  end;
end;