在centos下安装httpie
yum install -y python-pippip install --upgrade httpie
在ubuntu下安装httpie
sudo apt-get install httpie
或者
apt-get install -y python-pippip install --upgrade httpie
封装脚本
sudo vim /usr/bin/hpost
#!/bin/sh
allargs=$@if [ $# -eq 0 ];then
echo "Usage: $0 http://www.example.com"exit 0fi
t=$(date +%s)key="xxxxxxxxxxxxx"tsp=$(printf $t$key | sha1sum | awk '{ print $1 }')cmdexe="/usr/bin/http -f post $allargs _t=$t _tsp=$tsp User-Agent:iiitp-xxx-yyy-zzz "echo $cmdexe($cmdexe)
sudo chmod a+x /usr/bin/hpost #赋予可执行权限
demo:
/usr/bin/hpost http://www.iiitp.com
文章地址:http://www.iiitp.com/?post=44
来源:oschina
链接:https://my.oschina.net/u/1785808/blog/501971