Quantcast
Channel: LowEndTalk
Viewing all articles
Browse latest Browse all 39981

How to pass parameters from bash to php script?

$
0
0

I have a php script that I want to call from a bash script, but it needs parameters. I googled and found that I need to call the php script like this:
php /path/to/script/script.php -- 'op=deletestats&id=1&verify=yes'
The 'normal' http link to call the script is: http://127.0.0.1/path/to/script/script.php?op=deletestats&id=1&verify=yes

But I also need to modify my PHP script to use parse_str(), like so:
parse_str($argv[1]);

But where/how do I modify my PHP script to use parse_str()? Do I just add it at the top of the file ?

This is the php script I want to pass the parameters to:
http://www.phpkode.com/source/p/ultrastats/ultrastats-0.3.16/ultrastats-0.3.16/src/admin/parser-shell.php

Thanks!


Viewing all articles
Browse latest Browse all 39981

Trending Articles