RE: [PHP] PHP & Command Lines
| From: | Bjorn Sodergren | Date: | Sat, 01 Jul 2000 03:24:16 +0000 |
| Subject: | RE: [PHP] PHP & Command Lines | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4216@lists.php.net to get a copy of this message | ||
From another php'er
-----------------------------------------------------------------
#!/usr/bin/php -q
<?
for ($i = 0; $i < $argc; $i++)
switch ($argv[$i])
case "-i":
$ip = $argv[++$i];
break;
case "-d":
$domain = $argv[++$i];
break;
[...... Repeat as needed.......]
}
}
And then i have,
if(!$ip || !$domain || !$user){
echo<<<OPTIONS
you forgot something.
usage is:$argv[0] -i [ip] -d [domain] -u [user] [OPTIONS]
These are required fields...
-i Valid IP address. Will later incorprate checking into
the script
but for now please use one that isnt taken
-d Valid Domain name.
OPTIONS;
exit;
}
to check to see if i entered alll the right variables. compile php as a cgi
and your all set.
-----Original Message-----
From: Jonathan Chum [mailto:jchum@techdevelopers.com]
Sent: Friday, June 30, 2000 9:43 PM
To: php-general@lists.php.net
Subject: [PHP] PHP & Command Lines
I was wondering if PHP can handle command lines like PERL. Something
like example.php -1 -d
If so, would it be good thing to write a command line program in PHP.
I just finished coding a PERL indexing script, backend by MySQL with a
PHP3 interface. Now, I want to do it fully with PHP and was wondering
if doing so would be feasible with PHP. . . Thanks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net