Jump to content

php code behaves differently under CLI than when triggered by email pipe


Recommended Posts

Hi

I've got a problem that I think belongs here, but otherwise please move it.

 

I've been working on this script  for a while

function runbat($url)
{	
$i = 1;

//Set the path and filename
$filename = ("C:\\temp\\output".$i.".bat");

//if the file exists renumber the filename and rewrite the variable
while(file_exists($filename)){
     
          $i++;
          $filename = ("C:\\temp\\output".$i.".bat");

      }
    
//create the next highest filename and write to the file.
 $handle = fopen($filename, "a");
 $input = "@ECHO OFF \n";
 $input .= "SET BROWSER=firefox.exe \n";
 $input .= 'START %BROWSER% -new-tab ';
 $input .= '"'.$url.'"';
 fwrite($handle, $input);
 fclose($handle);


 $command = "C:\\Windows\\System32\\wscript.exe I:\\emailchecker\\invisible.vbs ";
 $command .= $filename;


 echo $command;

   	 //execute bat
 exec($command);
 //($return_value == 0) or die("returned an error: $command");
 sleep(5);
 unlink($filename);
}	

this block is the function that I think is having the issue, if people are curious I can post the rest.  Basically, when I run the whole script in CLI it's all working correctly.  When I trigger it with an email through the pipe, it creates the .bat file, waits and then deletes it.  But doesn't seem to actually run the script.  Thoughts as to why exec (or system() that also) would work in CLI but not when triggered with the email; or at least thoughts regarding how to trace down the problem?

 

Thanks

Tom

Another interesting/frustrating quirk:

 

this regex

$reg_exUrl = '%http://appraisalzone.lendervend.com/AssignOrder.aspx.[a-zA-Z0-9/?=&-]{1,}%';

pulls all of the url "http://appraisalzone.lendervend.com/AssignOrder.aspx?orderid=357262&userid=116315&customerorderid=EFC33B67-A60D-434B-99E1-7D4FA5C9DA1C" when run from CLI but only reads through orderid=357262 when run by the email pipe.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.