We've built a custom VB app that needs to be called from a .PHP script.
The syntax from the command line (that works) is:
If I pass that exact line to the command line via either the back tick, exec, or shell_exec, the app runs but fails with an error indicating the parameters did not pass correctly.
If I parse that command string with escapeshellcmd, the string becomes:
inetpub\wwwroot\Beta\test.php on line 6"
If I parse the command string with escapeshellarg, the string becomes:
If I parse the command part with escapeshellcmd and the arguments with escapeshellarg, then the string becomes:
If I parse the command part with escapeshellcmd and the arguments with escapeshellarg individually, then the string becomes:
How the heck can I parse this string so that it will execute correctly and pass the corrent arguments? I'm going batty trying to figure it out.
The syntax from the command line (that works) is:
code:<HR>Code:c:\sqltoexcel.exe /UID GWILSON /URL c:\inetpub\wwwroot\Beta\Reports\test.htm
If I pass that exact line to the command line via either the back tick, exec, or shell_exec, the app runs but fails with an error indicating the parameters did not pass correctly.
If I parse that command string with escapeshellcmd, the string becomes:
This also causes the app to fail with the same error and also produces a "PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ccode:<HR>Code:C:\\sqltoexcel.exe /UID GWILSON /URL C:\\inetpub\\wwwroot\\Beta\\Reports\\test.htm
inetpub\wwwroot\Beta\test.php on line 6"If I parse the command string with escapeshellarg, the string becomes:
This produces the exact same failure and warning as above.code:<HR>Code:'c:\sqltoexcel.exe /UID GWILSON /URL c:\inetpub\wwwroot\Beta\Reports\test.htm'
If I parse the command part with escapeshellcmd and the arguments with escapeshellarg, then the string becomes:
This again fails in the exact same way as the above two.code:<HR>Code:c:\\sqltoexcel.exe '/UID GWILSON /URL c:\inetpub\wwwroot\Beta\Reports\test.htm'
If I parse the command part with escapeshellcmd and the arguments with escapeshellarg individually, then the string becomes:
This again fails in the exact same way as the above three.code:<HR>Code:c:\\sqltoexcel.exe '/UID GWILSON' '/URL c:\inetpub\wwwroot\Beta\Reports\test.htm'
How the heck can I parse this string so that it will execute correctly and pass the corrent arguments? I'm going batty trying to figure it out.