I am writing a bash script where I am trying to send a post variable, but wget treats it as several URLs, which I consider because it is not URLENCODED ... here is my main idea
MESSAGE='I am trying to post this information' wget -O test.txt http://xxxxxxxxx.com/alert.php --post-data 'key=xxxx&message='$MESSAGE''
I get errors and alert.php does not receive the post variable plus it pretty mush says
cannot solve I cannot solve; cannot solve the problem .. etc.
My example above is a simple sudo example, but I believe that if I can encode it, it will pass, I even tried php, for example:
MESSAGE='I am trying to post this information' MESSAGE=$(php -r 'echo urlencode("'$MESSAGE'");')
but php errors .. any ideas? How to pass a variable to $ MESSAGE without executing php?
Greg Alexander
source share