PHP Cron and $_GET values
Posted 10 April 2006 - 03:55 AM
I have a script for my cart (that was a module that I didn't code) that generates a file to be uploaded to Froogle. So basically, I'm wanting something like this in my script.
php -q /path_to_file/file.php?data1=value1&data2=value2
Is this possible?
Posted 10 April 2006 - 04:34 AM
In you case, you should invoke it in one of these ways:
- php -q /path_to_file/file.php data1=value1&data2=value2
And then use the [a href=\"http://www.php.net/parse_str\" target=\"_blank\"]parse_str[/a]() function to get the values:
<?php parse_str($argv) ?>
- php -q /path_to_file/file.php value1 value2
and process it like
<?php for ($i=1;$i <= $argc; $i++) $data[$i] = $argv[$i] ?>
Posted 10 April 2006 - 01:21 PM
I would have to alter the original script to look for the $argv value instead of the $_GET values or both.
How is using parse_str() different from $_SERVER['argv'] (I was RTFM )?
Just curious. Is the $argv an associative array as well? Meaning instead of using a numerical index, can I reference it by name as in $_GET?
Thanks for your reply! Much appreciated!
Posted 10 April 2006 - 01:47 PM
Posted 10 April 2006 - 04:22 PM
Would this work or must I use the $argv?
//Parse the text to get the values. parse_str('download=tempfile&dltype=froogle'); //Replaced $_GET with $_SERVER in attempt to run from cli $ep_dltype = (isset($_SERVER['dltype'])) ? $_SERVER['dltype'] : $ep_dltype;
Posted 10 April 2006 - 04:51 PM
Posted 10 April 2006 - 04:56 PM
If this is all this cron job is going to do and these values aren't going to be in any way dynamic, why not just hard code the values into the script?
Good point! I guess I was thinking so outside the box that I didn't think to look inside of it. I suppose part of it was I wasn't for certain how the script ran as it's a third-part mod and was wanting to see if this way would be easier. But to be honest. I never even thought of that. LMAO!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users