Passing get variables to a script via cron job?

I’m trying to run a cron job that passes a get variable like so:

/usr/bin/php /home/script.php?code=xyz

I’m having trouble getting this to work, but the instructions for the script say it should work just fine.
I can run the script through command line, but adding ?code=xyz causes file not found errors. Is there something I need to enable first?

/usr/bin/php /home/script.php xyz


$argv = $_SERVER['argv'];
print 'You entered: ' . $argv[1];

You may find this post useful:

as well as:

I can’t edit the script, any other ways to get around it?

umm…why can’t you edit the script? And the only way to get around it is to run it from a browser, a url which I do not advise.

You’ll have to edit the script, any possible workaround would be inefficient and alot more work.

Do what drupal does, use lynx.

/usr/bin/lynx -source

A better approach would be to make a proxy script thats ran instead.


$_GET['code'] = $_SERVER['argv'][1];
require_once '/home/script.php';