Re: [PHP] PHP CGI mode and command line variables
That worked like a charm. Thanks Chris. I've added this to my snippet collection. :) At 12:02 AM 7/24/2003, Chris Shiflett wrote: --- CDitty [EMAIL PROTECTED] wrote: Thanks man. That got rid of the error, however it is not using the variable in the script. You have to read them in. I think you can just loop through $argv, so something like this will show you what PHP is receiving: ? echo A total of $argc parameters are available:\n\n; foreach ($argv as $curr_parameter) { echo $curr_parameter\n; } ? Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI mode and command line variables
I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood This is the error that it returns - Could not open input file: ./import.php?feed=eastwood Can anyone offer any advice for making this work? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
--- CDitty [EMAIL PROTECTED] wrote: I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood I might be wrong, but I don't think it's possible to simulate GET or POST from the command line like that. I always have a shell script perspective and pass things in as arguments like this: ./import.php --feed=eastwood Of course, if it's under document root, you can test from the command line using wget. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
Thanks man. That got rid of the error, however it is not using the variable in the script. I can't run this via wget or the browser since the importing files are rather large. Any other ideas? Chris At 11:33 PM 7/23/2003, Chris Shiflett wrote: --- CDitty [EMAIL PROTECTED] wrote: I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood I might be wrong, but I don't think it's possible to simulate GET or POST from the command line like that. I always have a shell script perspective and pass things in as arguments like this: ./import.php --feed=eastwood Of course, if it's under document root, you can test from the command line using wget. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
--- CDitty [EMAIL PROTECTED] wrote: Thanks man. That got rid of the error, however it is not using the variable in the script. You have to read them in. I think you can just loop through $argv, so something like this will show you what PHP is receiving: ? echo A total of $argc parameters are available:\n\n; foreach ($argv as $curr_parameter) { echo $curr_parameter\n; } ? Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php