Printing From Command Line 追蹤

Legacy Poster


I'm wonder if anyone ever tried to print labels from php via command line. Im up to develop a modul for a webshop with the functionality of printing labels for products.
Here is the code:
$execString = "CMD /C \"\"c:\\Program Files\\Seagull\\BarTender Suite\\bartend.exe\" /F=\"d:\\ASD\\DSA\\Test1.btw\" /UID=\"**\" /PWD=\"****\" /W=\"OITM.ItemCode LIKE '%".$_POST[$refName.$i]."%'\" /p /C=".intval($_POST['qty'.$i]). " /CLOSE /X\" && exit";

If i post a form with refNames and quantities, the page start to load, and its goes for infinite. (No, i don't have infinite loops in the code)

Thanks for any suggestions!

1 意見

Shotaro Ito
評論操作 永久連結

Hi Tushee,
First, check $execString 's output result to see the shell command is properly created.

Using command line automation from Web application (or by any method) is not recommendable as it would be slow and unstable. I recommend you to use Commander instead.
When you planned command line automation, use Commander script is easy option.

See white paper below:
[url=""]Commander Examples[/url]

You can create a Text trigger file for Commander script by single command - echo.
[code]CMD /c echo %BTW% AF="c:\Test1.btw" /P> "c:\Scan\trigger.dd"[/code]
creates a text file "c:\Scan\trigger.dd".

(or you can create trigger text file by PHP - which I'm not familiar with <_< )