El MoselYEE Posted April 23, 2007 Share Posted April 23, 2007 i want to get a similar result as if i typed this in the browser: '/test.php?id=10' no matter what i try, i can't seem to get it to work, here is my code: $process = proc_open ('php /home/linkingp/test.php?id=10 &', Array (), $foo); sleep(1); proc_close ($process); here are a few of the things i have tried, none of which work (first two run test.php, but without parameters, second two don't even run the script): 'php /home/linkingp/test.php -- id=10 &' 'php /home/linkingp/test.php -- $id=10 &' 'php -r "$id=10" /home/linkingp/test.php &' 'php -r "id=10" /home/linkingp/test.php &' i have also tried setting up mod_rewrite, but for some reason that does not work either. here is the manual for the command line, if it helps: http://php.net/features.commandline EDIT: all i need the script to do is call a PHP script and return to the current PHP page without requiring the called script to finish first. so if someone knows a better way to do this (using exec() for example), feel free to let me know...i have no idea what i'm doing so i'm all open ears...thanks! Link to comment https://forums.phpfreaks.com/topic/48283-solved-trying-to-pass-a-query-string-through-the-command-line/ Share on other sites More sharing options...
trq Posted April 23, 2007 Share Posted April 23, 2007 Maybe you want to have a read of that man page yourself. An example. foo.php #!/usr/bin/php <?php if (isset($_SERVER['argv'])) { foreach($_SERVER['argv'] as $arg) { echo $arg."\n"; } } ?> Then, to call the script. (From the terminal) $ chmod 755 foo.php $ ./foo.php this is foo Link to comment https://forums.phpfreaks.com/topic/48283-solved-trying-to-pass-a-query-string-through-the-command-line/#findComment-236031 Share on other sites More sharing options...
El MoselYEE Posted April 23, 2007 Author Share Posted April 23, 2007 perfect, thanks! Link to comment https://forums.phpfreaks.com/topic/48283-solved-trying-to-pass-a-query-string-through-the-command-line/#findComment-236096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.