【发布时间】:2012-08-06 06:16:48
【问题描述】:
我正在编写一个 bash 脚本,我试图在其中提交一个 post 变量,但是我相信 wget 将它视为多个 URL,因为它不是 URLENCODED ......这是我的基本想法
MESSAGE='I am trying to post this information'
wget -O test.txt http://xxxxxxxxx.com/alert.php --post-data 'key=xxxx&message='$MESSAGE''
我收到错误,alert.php 没有收到 post 变量,而且它在说
无法解决我 无法解决我 无法解决尝试 ..等等。
我上面的例子是一个简单的 sudo 例子,但我相信如果我可以对它进行 url 编码,它会通过,我什至尝试过 php 之类的:
MESSAGE='I am trying to post this information'
MESSAGE=$(php -r 'echo urlencode("'$MESSAGE'");')
但是 php 出错了.. 有什么想法吗?如何在不执行 php 的情况下传递 $MESSAGE 中的变量?
【问题讨论】:
-
寻找我的答案here。
标签: linux bash command-line wget urlencode