Typical attempt (may have // unnecessarily to escape / symbol??)
lptout.exe is in rooot of C:
Where am I going wrong??
<?php
// It is known that 'lptout.exe', in root of C:, correctly works via RUN ->CMD ->command window
// eg 'lptout 0' or 'lptout 255' or 'lptout $aa' all work ( if isued twice- see earlier comment)
// and LEDs on outport change appropriately.
// What I seem unable to do is call the exe to control them from php!!!
// Not only does it do nothing on the port, it creates a very slow reload while it waits for something.
$xff =chr( 255);
$x80 =chr( 128);
$x40 =chr( 64);
$x0 =chr( 0);
if (isset($_POST['up']))
// Using the syntax:- start -b(lack boxed) ["window name"] "path to exe", output$, return$
// ie I want to issue basically the commands like 'lptout 128' as shown above.
{
exec( 'start //B "C:/lptout.exe"', $xff);
exec( 'start //B "C:/lptout.exe"', $xff);
}
if (isset($_POST['right']))
{
exec( 'start //B "C:/lptout.exe"', $x80);
exec( 'start //B "C:/lptout.exe"', $x80);
}
if (isset($_POST['down']))
{
exec( 'start //B "C:/lptout.exe"', $x40);
exec( 'start //B "C:/lptout.exe"', $x40);
}
if (isset($_POST['left']))
{
exec( 'start //B "C:/lptout.exe"', $x0);
exec( 'start //B "C:/lptout.exe"', $x0);
}
?>
<HTML>
<HEAD><TITLE>webcam controls</TITLE></HEAD>
<BODY>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<INPUT type='submit' name='up' value='up'>
<INPUT type='submit' name='right' value='Right'>
<INPUT type='submit' name='left' value='Left'>
<INPUT type='submit' name='down' value='Down'>
</form>
</body>
</html>