Re: [PHP] Re: Passing args to a PHP script from the command line
Ben Ramsey wrote: Did I say the wrong package? Oops. GetOpts does the job, but GetArgs is brand spanking new and much more configurable. However, unless you already use other PEAR packages I would think twice about loading the big Pear codebase just to parse a few commandline options. -- Aaron Wormus -- Pears and Pickles Served fresh every day at http://php.eckspee.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Passing args to a PHP script from the command line
Aaron Wormus wrote: Ben Ramsey wrote: > You may also want to check out PEAR::Console_Getopt > > http://pear.php.net/package/Console_Getopt or better yet PEAR::Console_GetArgs http://pear.php.net/package/Console_Getargs Did I say the wrong package? Oops. Both are for the command line, but Aaron's right: I was thinking about the Getargs one. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Passing args to a PHP script from the command line
Ben Ramsey wrote: > You may also want to check out PEAR::Console_Getopt > > http://pear.php.net/package/Console_Getopt or better yet PEAR::Console_GetArgs http://pear.php.net/package/Console_Getargs -- Aaron Wormus -- Pears and Pickles Served fresh every day at http://php.eckspee.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing args to a PHP script from the command line
You may also want to check out PEAR::Console_Getopt http://pear.php.net/package/Console_Getopt Phil Ewington - 43 Plc wrote: Hi All, Can anyone tell me how to pass arguments to a PHP script from the command line? I know I need to use the -args option but how exactly, I have tried the following... /usr/bin/php myscript.php -args key=value but this does not work, the script executes but key is not available as $_GET["key"] in my script. Any pointers will be much appreciated. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php