Note that there are some explanatory texts on larger screens.

plurals
  1. POMy iMacro script(s) doesnt run inside my PHP script. Why?
    primarykey
    data
    text
    <p>I am learning how to run iMacros from my php scripts so that PHP script calls an iMacros browser session and passes any variables that I have (url and macro name for example). The iMacros session then runs the iMacro, after the macro is done running it passes the resulting html page back to the PHP script and closes itself. In an ideal world, anyway.</p> <p>Here is the iMacros calling script:</p> <pre><code>&lt;?php require 'src/iimfx.class.php'; $iim = new imacros(); $vars = array(); $iim-&gt;play($vars,'grab_data.iim'); ?&gt; </code></pre> <p>But when i run this script from cmd.exe [command line] on WAMP, I get this:</p> <pre><code>New imacros session started! Using Proxy: MY_PROXY_IP:MY_PROXY_PORT -runner -fx -fxProfile default -------------------------------------------------------- Setting Value IP =&gt; MY_PROXY_IP Setting Value port =&gt; MY_PROXY_PORT Playing Macro proxy.iim --------MACRO ERROR!------------------- ERROR: Browser was not started. iimInit() failed? -------------------------------------------------------- Playing Macro grab_google.iim --------MACRO ERROR!------------------- ERROR: Browser was not started. iimInit() failed? </code></pre> <p>P.S. MY_PROXY_IP and MY_PROXY_PORT are replaced with actual numbers both in error messages above and iimfx.class.php.</p> <p>And here is code for the iimfx.class.php :</p> <pre><code>&lt;?php class imacros { function __construct($proxyip = 'MY_PROXY_IP', $proxyport = 'MY_PROXY_PORT', $silent = false, $noexit = false) { echo "--------------------------------------\nNew imacros session started!\nUsing Proxy: $proxyip:$proxyport\n"; $this-&gt;proxyip = $proxyip; $this-&gt;proxyport = $proxyport; if (empty ( $this-&gt;proxyip )) echo "NO PROXY!!\n"; $this-&gt;noexit = $noexit; $this-&gt;fso = new COM ( 'Scripting.FileSystemObject' ); $this-&gt;fso = NULL; $this-&gt;iim = new COM ( "imacros" ); $toexec = "-runner -fx -fxProfile default"; if ($silent === true) $toexec .= " -silent"; if ($noexit === true) $toexec .= " -noexit"; echo $toexec . "\n"; $this-&gt;iim-&gt;iimInit ( $toexec ); if (! empty ( $this-&gt;proxyip )) { $dvars ['IP'] = $this-&gt;proxyip; $dvars ['port'] = $this-&gt;proxyport; $this-&gt;play ( $dvars, 'proxy.iim' ); } } function __destruct() { if ($this-&gt;noexit === false) $this-&gt;iim-&gt;iimExit (); } function play($immvars = '', $macro) { echo "--------------------------------------------------------\n"; if (is_array ( $immvars )) { foreach ( $immvars as $key =&gt; $value ) { echo "Setting Value $key =&gt; $value\n"; $this-&gt;iim-&gt;iimSet ( "-var_" . $key, $value ); } } echo "Playing Macro $macro\n"; $s = $this-&gt;iim-&gt;iimPlay ( $macro ); if($s&gt;0){ echo "Macro successfully played!\n"; }else{ echo "--------MACRO ERROR!-------------------\n ERROR: " . $this-&gt;getLastError() . "\n"; } return $s; } // This function retrieves extracts in your iMacros script if you have any. function getLastExtract($num) { return $this-&gt;iim-&gt;iimGetLastExtract ( $num ); } // Returns the last error :) function getLastError(){ return $this-&gt;iim-&gt;iimGetLastError(); } // Enables/disables images function setImages($images = 1) { // 1 = on 2 = off $dvars ['images'] = $images; $this-&gt;play ( $dvars, 'images.iim' ); } // Enables or disables adblockplus function enableABP($status = true){ $dvars['status'] = $status; $this-&gt;play ( $dvars, 'abp.iim' ); } } ?&gt; </code></pre> <p>Is there something I am missing here? I have iimRunner.exe running during all of this [started manually before running the script] and I have iMacros Browser V8+. Also, my grab_data.iim and all other required .iim are in the same place as the php script that is trying to call them and execute them.</p> <p>Any kind of help and/or steer towards the right direction would be greatly appreciated!! Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload