Here's how to use PHP with iMacros
This PHP examples shows how to start iMacros from a PHP script from Apache or IIS running on a Windows Server.
The script can be started remotely via a URL in the form http://your-address.com/?macro=yourmacro&keyword=yourkeyword It displays the results on the website after the iMacros run (iimPlay) is completed. This method can be used to call iMacros remotely from another machine, for example a monitoring server running on the Linux OS or to collect the data from several monitoring stations to a central unit.
<?php $iim1 = new COM("imacros"); $s = $iim1->iimOpen("-runner"); $s = $iim1->iimSet("keyword", $_GET["keyword"]); $s = $iim1->iimPlay($_GET["macro"]); echo "iimplay="; echo $s; echo "extract="; echo $iim1->iimGetExtract; $s = $iim1->iimClose(); ?>
- You can use the iimGetExtract command to return complete performance monitoring data and display it. Please see this response time measurement VBS macro for details.
- Note: iimRunner is required if your web server process runs in a restricted user account. In this case you need to launch iMacros in an unrestricted account via iimRunner. iimRunner must be started manually or via task scheduler before running the script. Otherwise iimOpen ("-runner") returns an error code.