Re: [PHP] PHP to access shell script to print barcodes

2010-03-24 Thread Peter Lind
The problem you're getting is that your web-server interprets the
request as a request for a normal file and just sends it - in effect,
you're not outputting the postscript file, you're just sending the
.php file. Normally, you'll only get your php executed if the file
requested is a .php or .phtml - unless you've changed your server
config.

Try creating a serveps.php that uses the header(Content-Disposition:
attachment; filename: 'serveps.ps') instead, see if that helps you.

Regards

On 24 March 2010 06:09, Rob Gould gould...@me.com wrote:
 Well, that did something, and it does sound like it should work.  I've 
 scoured the web and haven't found anyone with code that does what I'm trying 
 to do.

 I've got a working, hardcoded Postscript file here:

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

 But I need to somehow serve it with PHP, so I can change some variables in it.

 By putting headers in place with PHP, and then doing an echo of the 
 postscript, I get postscript errors (though Preview doesn't tell me what the 
 error is):

 http://www.winecarepro.com/kiosk/fast/shell/serverps.ps

 Trying to trick the web-browser into thinking it's receiving Postscript from 
 a PHP file is tricky.  I don't know what to do next.

 Here's the code I was using in the above url:  
 http://www.winecarepro.com/kiosk/fast/shell/serveps.php.zip

 It's not clear to me if the server is parsing the postscript first and then 
 serving it, or if the server is server the postscript as-is and the browser 
 sends it to Preview which interprets it.

 I basically want to replicate the functionality found here:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/



 On Mar 23, 2010, at 5:37 PM, Peter Lind wrote:

 You can create a .php script that sets a proper header to make the
 browser download the file rather than display it. That also allows you
 to set the filename for the download. What you'd need to do is include
 something like:

 header(Content-Disposition: attachment; filename: 'barcodemerge.ps');

 That tells the browser to download the file. You can also try setting
 the content-type

 header('Content-type: application/postscript');

 Either of the above might do the trick for you.

 Regards
 Peter

 On 23 March 2010 22:10, Rob Gould gould...@me.com wrote:
 I love the idea of using PHP to insert data into Postscript.  I'm just not 
 sure how to make it happen.

 The good news is that I've got barcodes drawing just the way I need them:

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

 The bad news is that's all hard-coded Postscript.  I'd like to take your 
 suggestion and use PHP to loop-through and draw the barcodes - - - however, 
 if I put anything that resembles PHP in my .ps file, bad things happen.

 Anyone know the secret to creating a postscript .ps file that had PHP code 
 injecting data into it?

 Here's the source file that works.  Where PHP would be handy is at the very 
 bottom of the script

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip


 On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:

 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do 
 this on this page:

 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:

 http://www.winecarepro.com/kiosk/fast/shell/

 Notice how the last few lines contain the shell-script that renders the 
 postscript:

 #!/bin/bash

 BASE=”100″;
 NR=$BASE

 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done


 I need to somehow create a PHP script that executes this shell script. 
  And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:

 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

 Which has the following script:

 ?php

 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);

 echo $arr;

 ?


 And, as you can see, nothing works.  I guess firstly, I'd like to know:

 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.

 the shell script in question needs to have 

Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Richard Quadling
On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this on 
 this page:

 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:

 http://www.winecarepro.com/kiosk/fast/shell/

 Notice how the last few lines contain the shell-script that renders the 
 postscript:

 #!/bin/bash

 BASE=”100″;
 NR=$BASE

 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done


 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:

 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

 Which has the following script:

 ?php

 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);

 echo $arr;

 ?


 And, as you can see, nothing works.  I guess firstly, I'd like to know:

 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.

 the shell script in question needs to have the executable bit set in order to 
 run (either that or change to command to
 run bash with your script as an argument)

 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



I think this is a translation of the script to PHP.

?php
$BASE = 100;
$NR   = $BASE;

foreach(array(30, 220, 410) as $hor) {
$ver = 740;
while ($ver = 40) {
printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
code39
barcode\n, $NR);
$ver -= 70;
++$NR;
}
}



It produces output like ...

30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
220 460 moveto (000115L3) (includetext height=0.55) code39 barcode
220 390 moveto (000116L3) (includetext height=0.55) code39 barcode
220 320 moveto (000117L3) (includetext height=0.55) code39 barcode
220 250 moveto (000118L3) (includetext height=0.55) code39 barcode
220 180 moveto (000119L3) (includetext height=0.55) code39 barcode
220 110 moveto (000120L3) (includetext height=0.55) code39 barcode
220 40 moveto (000121L3) (includetext height=0.55) code39 barcode
410 740 moveto (000122L3) (includetext height=0.55) code39 barcode
410 670 moveto (000123L3) (includetext height=0.55) code39 barcode
410 600 moveto (000124L3) (includetext height=0.55) code39 barcode
410 530 moveto (000125L3) (includetext height=0.55) code39 barcode
410 460 moveto (000126L3) (includetext height=0.55) code39 barcode
410 390 moveto (000127L3) (includetext height=0.55) code39 barcode
410 320 moveto (000128L3) (includetext height=0.55) code39 barcode
410 250 moveto (000129L3) (includetext height=0.55) code39 barcode
410 180 moveto (000130L3) (includetext height=0.55) code39 barcode
410 110 moveto (000131L3) (includetext height=0.55) code39 barcode
410 40 moveto (000132L3) (includetext height=0.55) code39 barcode


No idea if that is accurate or not. If you can run the script by hand
once to confirm, then
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : 

Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Rob Gould
I love the idea of using PHP to insert data into Postscript.  I'm just not sure 
how to make it happen.

The good news is that I've got barcodes drawing just the way I need them:

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

The bad news is that's all hard-coded Postscript.  I'd like to take your 
suggestion and use PHP to loop-through and draw the barcodes - - - however, if 
I put anything that resembles PHP in my .ps file, bad things happen.

Anyone know the secret to creating a postscript .ps file that had PHP code 
injecting data into it?

Here's the source file that works.  Where PHP would be handy is at the very 
bottom of the script

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip


On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:

 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to know:
 
 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.
 
 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.
 
 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)
 
 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 I think this is a translation of the script to PHP.
 
 ?php
 $BASE = 100;
 $NR   = $BASE;
 
 foreach(array(30, 220, 410) as $hor) {
   $ver = 740;
   while ($ver = 40) {
   printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
 code39
 barcode\n, $NR);
   $ver -= 70;
   ++$NR;
   }
 }
 
 
 
 It produces output like ...
 
 30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
 30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
 30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
 30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
 30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
 30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
 30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
 30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
 30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
 30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
 30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
 220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
 220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
 220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
 220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
 220 460 moveto (000115L3) (includetext height=0.55) code39 barcode
 220 390 moveto (000116L3) (includetext height=0.55) code39 barcode
 220 320 moveto (000117L3) (includetext height=0.55) code39 barcode
 220 250 moveto (000118L3) (includetext height=0.55) code39 barcode
 220 180 moveto (000119L3) (includetext height=0.55) code39 barcode
 220 110 moveto (000120L3) (includetext height=0.55) code39 barcode
 220 40 moveto (000121L3) (includetext height=0.55) code39 barcode
 410 740 moveto (000122L3) (includetext height=0.55) code39 barcode
 410 

Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Peter Lind
You can create a .php script that sets a proper header to make the
browser download the file rather than display it. That also allows you
to set the filename for the download. What you'd need to do is include
something like:

header(Content-Disposition: attachment; filename: 'barcodemerge.ps');

That tells the browser to download the file. You can also try setting
the content-type

header('Content-type: application/postscript');

Either of the above might do the trick for you.

Regards
Peter

On 23 March 2010 22:10, Rob Gould gould...@me.com wrote:
 I love the idea of using PHP to insert data into Postscript.  I'm just not 
 sure how to make it happen.

 The good news is that I've got barcodes drawing just the way I need them:

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

 The bad news is that's all hard-coded Postscript.  I'd like to take your 
 suggestion and use PHP to loop-through and draw the barcodes - - - however, 
 if I put anything that resembles PHP in my .ps file, bad things happen.

 Anyone know the secret to creating a postscript .ps file that had PHP code 
 injecting data into it?

 Here's the source file that works.  Where PHP would be handy is at the very 
 bottom of the script

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip


 On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:

 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:

 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:

 http://www.winecarepro.com/kiosk/fast/shell/

 Notice how the last few lines contain the shell-script that renders the 
 postscript:

 #!/bin/bash

 BASE=”100″;
 NR=$BASE

 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done


 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:

 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

 Which has the following script:

 ?php

 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);

 echo $arr;

 ?


 And, as you can see, nothing works.  I guess firstly, I'd like to know:

 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.

 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)

 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 I think this is a translation of the script to PHP.

 ?php
 $BASE = 100;
 $NR   = $BASE;

 foreach(array(30, 220, 410) as $hor) {
       $ver = 740;
       while ($ver = 40) {
               printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
 code39
 barcode\n, $NR);
               $ver -= 70;
               ++$NR;
       }
 }



 It produces output like ...

 30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
 30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
 30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
 30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
 30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
 30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
 30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
 30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
 30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
 30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
 30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
 220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
 220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
 220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
 220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
 220 460 

Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Rob Gould
Well, that did something, and it does sound like it should work.  I've scoured 
the web and haven't found anyone with code that does what I'm trying to do.

I've got a working, hardcoded Postscript file here:

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

But I need to somehow serve it with PHP, so I can change some variables in it.  

By putting headers in place with PHP, and then doing an echo of the 
postscript, I get postscript errors (though Preview doesn't tell me what the 
error is):

http://www.winecarepro.com/kiosk/fast/shell/serverps.ps

Trying to trick the web-browser into thinking it's receiving Postscript from a 
PHP file is tricky.  I don't know what to do next.

Here's the code I was using in the above url:  
http://www.winecarepro.com/kiosk/fast/shell/serveps.php.zip

It's not clear to me if the server is parsing the postscript first and then 
serving it, or if the server is server the postscript as-is and the browser 
sends it to Preview which interprets it.

I basically want to replicate the functionality found here:

http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/



On Mar 23, 2010, at 5:37 PM, Peter Lind wrote:

 You can create a .php script that sets a proper header to make the
 browser download the file rather than display it. That also allows you
 to set the filename for the download. What you'd need to do is include
 something like:
 
 header(Content-Disposition: attachment; filename: 'barcodemerge.ps');
 
 That tells the browser to download the file. You can also try setting
 the content-type
 
 header('Content-type: application/postscript');
 
 Either of the above might do the trick for you.
 
 Regards
 Peter
 
 On 23 March 2010 22:10, Rob Gould gould...@me.com wrote:
 I love the idea of using PHP to insert data into Postscript.  I'm just not 
 sure how to make it happen.
 
 The good news is that I've got barcodes drawing just the way I need them:
 
 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps
 
 The bad news is that's all hard-coded Postscript.  I'd like to take your 
 suggestion and use PHP to loop-through and draw the barcodes - - - however, 
 if I put anything that resembles PHP in my .ps file, bad things happen.
 
 Anyone know the secret to creating a postscript .ps file that had PHP code 
 injecting data into it?
 
 Here's the source file that works.  Where PHP would be handy is at the very 
 bottom of the script
 
 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip
 
 
 On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:
 
 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to know:
 
 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.
 
 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.
 
 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)
 
 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 I think this is a translation of the script to PHP.
 
 ?php
 $BASE = 100;
 $NR   = $BASE;
 
 foreach(array(30, 220, 410) as $hor) {
   $ver = 740;
   

Re: [PHP] PHP to access shell script to print barcodes

2010-03-22 Thread Jochem Maas
Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this on 
 this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  And 
 after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php 
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to know:
 
 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

that's what exec() is for. $command need to contain a *local* path to the 
command in question, currently your
trying to pass a url to bash ... which obviously doesn't do much.

the shell script in question needs to have the executable bit set in order to 
run (either that or change to command to
run bash with your script as an argument)

I'd also suggest putting the shell script outside of your webroot, or at least 
in a directory that's not accessable
from the web.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and linux shell script

2005-04-19 Thread Rory Browne
 http://gtk.php.net/
 

Can you elaborate on what gtk has to do with making command line dialog boxes?


 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and linux shell script

2005-04-19 Thread Richard Lynch
On Tue, April 19, 2005 2:24 pm, Rory Browne said:
 http://gtk.php.net/


 Can you elaborate on what gtk has to do with making command line dialog
 boxes?

Well, you run it from the command line.

And it makes dialog boxes.

Maybe not the kind of dialog boxes you wanted or whatever, but that pretty
much sums up GTK PHP in a nutshell...

One should also consider http://php.net/ncurses, but that was already
referenced, I do believe.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and linux shell script

2005-04-18 Thread Richard Lynch
On Thu, April 14, 2005 11:52 pm, Balwant Singh said:
 1) first of all i would like to inform you that i have made a PHP script
 which also have some amount of
 linux shell script in it for converting emails from EVOLUTION to MOZILA
 THUNDERBIRD just by executing
 this script.  if anybody need it, do let me know, i will send the same.

 2) i am also exploring possibilities of using linux dialog boxes (used in
 shell scripting)
 with PHP. has anybody tried it, may please advise me how to call dialog
 boxes through PHP in CLI.
 also please share with me if u have information on how to use PHP with
 Shell Scripting.

http://gtk.php.net/

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and linux shell script

2005-04-15 Thread Rory Browne
I don't think you'll find anything in PHP as simple as the shell
script version of dialog, but you may be able to bang something
together like that using ncurses.

Probably handier if your time is more important than the machines, to
just use the shell version using one of the Program Executions
functions.

Personally I suggest passthru:
?php

function yesno($str){
  $tmpvar = 0; // to avoid E_NOTICE
  passthru(dialog --yesno  . escapeshellarg($str) .  200 10, $tmpvar);
  return $tmpvar;
}

?


On 15 Apr 2005 12:22:05 +0530, Balwant Singh [EMAIL PROTECTED] wrote:
 hello,
 
 1) first of all i would like to inform you that i have made a PHP script 
 which also have some amount of
 linux shell script in it for converting emails from EVOLUTION to MOZILA 
 THUNDERBIRD just by executing
 this script.  if anybody need it, do let me know, i will send the same.
 
 2) i am also exploring possibilities of using linux dialog boxes (used in 
 shell scripting)
 with PHP. has anybody tried it, may please advise me how to call dialog boxes 
 through PHP in CLI.
 also please share with me if u have information on how to use PHP with Shell 
 Scripting.
 
 thx
 
 with best wishes
 balwant singh
 [EMAIL PROTECTED]
 0091-120-2568472
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and linux shell script

2005-04-15 Thread Andy Pieters
On Friday 15 April 2005 08:52, Balwant Singh wrote:
 2) i am also exploring possibilities of using linux dialog boxes (used in
 shell scripting) with PHP. has anybody tried it, may please advise me how
 to call dialog boxes through PHP in CLI. also please share with me if u
 have information on how to use PHP with Shell Scripting.


Hi

I like to think of PHP as a stream programming language.  You can use it to 
generate a stream of html documents, images, sound files, text files, etc etc 
etc.

So why shouldn't you use it to make your own dialogs in it as well?

Make an include file that contains the classes, then just declare your class 
and use it.

Like

$mydialog=new clsDialog;
$mydialog-type=DIALOGTYPE_INPUTBOX;
$mydialog-title=Provide some information;
$mydialog-regexp=$xxx^;

$result=$mydialog-showDialog();
unset($mydialog);

Off course the limitations are second to none!

I have released some PHP CLI scripts under the terms of GPL2 and they all use 
the same basic simple engine for argument processing.  It may not suit your 
needs, but you're welcome to study it to get you started.

With kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++
L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e$@ h++(*) r--++ y--()
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--


sas_php_script.php
Description: application/php
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP as a shell script

2001-07-09 Thread Ben Bleything

It's simple.  Find your php binary (or build one if you don't have
one)... I think 'which php' will find it.

Then, write a php file with '#!/path/to/php -q' at the top.  Use any one
of the various execution methods to run your programs.  Done!

I've been doing this for quite a while.  I find it easier than
'traditional' shell scripting =

More questions?  Ask!
Ben

-Original Message-
From: Kevin Pratt [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 09, 2001 10:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP as a shell script

Can anyone direct me to a place where I can read up on how to use php as
a
shell scripting language?


Thanks Kevin
Ouelong Group
www.ouelong.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP as a shell script

2001-07-09 Thread Kevin Pratt

Is there any special switches I have to pass to the compile of php to create
the php binary?

Kevin
- Original Message -
From: Ben Bleything [EMAIL PROTECTED]
To: 'Kevin Pratt' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, July 09, 2001 11:03 AM
Subject: RE: [PHP] PHP as a shell script


 It's simple.  Find your php binary (or build one if you don't have
 one)... I think 'which php' will find it.

 Then, write a php file with '#!/path/to/php -q' at the top.  Use any one
 of the various execution methods to run your programs.  Done!

 I've been doing this for quite a while.  I find it easier than
 'traditional' shell scripting =

 More questions?  Ask!
 Ben

 -Original Message-
 From: Kevin Pratt [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 09, 2001 10:02 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP as a shell script

 Can anyone direct me to a place where I can read up on how to use php as
 a
 shell scripting language?


 Thanks Kevin
 Ouelong Group
 www.ouelong.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP as a shell script

2001-07-09 Thread bleythbe

There are... but I'm not sure what they are.  If you
build PHP _without_ any options, I believe you will get
the binary.

Read the documentation that comes with the source.  It
will show you the way.

Ben

Quoting Kevin Pratt [EMAIL PROTECTED]:

 Is there any special switches I have to pass to
 the compile of php to create
 the php binary?
 
 Kevin
 - Original Message -
 From: Ben Bleything
 [EMAIL PROTECTED]
 To: 'Kevin Pratt' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Monday, July 09, 2001 11:03 AM
 Subject: RE: [PHP] PHP as a shell script
 
 
  It's simple.  Find your php binary (or build
 one if you don't have
  one)... I think 'which php' will find it.
 
  Then, write a php file with '#!/path/to/php
 -q' at the top.  Use any one
  of the various execution methods to run your
 programs.  Done!
 
  I've been doing this for quite a while.  I
 find it easier than
  'traditional' shell scripting =
 
  More questions?  Ask!
  Ben
 
  -Original Message-
  From: Kevin Pratt [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 09, 2001 10:02 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] PHP as a shell script
 
  Can anyone direct me to a place where I can
 read up on how to use php as
  a
  shell scripting language?
 
 
  Thanks Kevin
  Ouelong Group
  www.ouelong.com
 
 
  --
  PHP General Mailing List
 (http://www.php.net/)
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List
 (http://www.php.net/)
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP as a shell script

2001-07-09 Thread Tyler Longren

Just don't compile it with apache or some other web server.  It should
create the executable then.

Tyler

- Original Message -
From: Kevin Pratt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 09, 2001 12:01 PM
Subject: [PHP] PHP as a shell script


 Can anyone direct me to a place where I can read up on how to use php as a
 shell scripting language?


 Thanks Kevin
 Ouelong Group
 www.ouelong.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP as a shell script

2001-07-09 Thread scott [gts]

dont use --with-apxs or --with-apache

./configure --my-options
make
make test
make install

that should do it.

 -Original Message-
 From: Tyler Longren [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 09, 2001 3:07 PM
 To: Kevin Pratt; [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP as a shell script
 
 
 Just don't compile it with apache or some other web server.  It should
 create the executable then.
 
 Tyler
 
 - Original Message -
 From: Kevin Pratt [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, July 09, 2001 12:01 PM
 Subject: [PHP] PHP as a shell script
 
 
  Can anyone direct me to a place where I can read up on how to use php as a
  shell scripting language?
 
 
  Thanks Kevin
  Ouelong Group
  www.ouelong.com
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP as a shell script

2001-07-09 Thread Kevin Pratt

Yep all done thanks...
Kevin
- Original Message -
From: scott [gts] [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Monday, July 09, 2001 1:26 PM
Subject: RE: [PHP] PHP as a shell script


 dont use --with-apxs or --with-apache

 ./configure --my-options
 make
 make test
 make install

 that should do it.

  -Original Message-
  From: Tyler Longren [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 09, 2001 3:07 PM
  To: Kevin Pratt; [EMAIL PROTECTED]
  Subject: Re: [PHP] PHP as a shell script
 
 
  Just don't compile it with apache or some other web server.  It should
  create the executable then.
 
  Tyler
 
  - Original Message -
  From: Kevin Pratt [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, July 09, 2001 12:01 PM
  Subject: [PHP] PHP as a shell script
 
 
   Can anyone direct me to a place where I can read up on how to use php
as a
   shell scripting language?
  
  
   Thanks Kevin
   Ouelong Group
   www.ouelong.com
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
[EMAIL PROTECTED]
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]