0

I am trying to call a php script from a crontab sh script... I can get it to work if I hardcode each file, but I want to pass a variable to a single php file either from hardcoded calls in the sh script, or even better, by looping through an array.

Here is my script basics...

#!/bin/bash
cd  /home/account/myfolder;
php -q /home/account/myfolder/do_stuff.php?id=1; //calls the php but a $_REQUEST['id'] in the php is blank...
php -q /home/account/myfolder/do_stuff.php?id=2; //calls the php but a $_REQUEST['id'] in the php is blank...
php -q /home/account/myfolder/do_stuff.php?id=3; //calls the php but a $_REQUEST['id'] in the php is blank...

Needless to say, the script is not getting any url parameters from above.... how can I pass a value from a shell script to my php file or what is a better way to do this... I have about 60 ids I need to pass to the script...

Thanks!

Edited by tekneck: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by kireol
0

I am trying to call a php script from a crontab sh script... I can get it to work if I hardcode each file, but I want to pass a variable to a single php file either from hardcoded calls in the sh script, or even better, by looping through an array.

Here is my script basics...

#!/bin/bash
cd  /home/account/myfolder;
php -q /home/account/myfolder/do_stuff.php?id=1; //calls the php but a $_REQUEST['id'] in the php is blank...
php -q /home/account/myfolder/do_stuff.php?id=2; //calls the php but a $_REQUEST['id'] in the php is blank...
php -q /home/account/myfolder/do_stuff.php?id=3; //calls the php but a $_REQUEST['id'] in the php is blank...

Needless to say, the script is not getting any url parameters from above.... how can I pass a value from a shell script to my php file or what is a better way to do this... I have about 60 ids I need to pass to the script...

Thanks!

:)

you need argc and argv
http://php.net/manual/en/features.commandline.php

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.