我在PHP中发现这个小脚本向twitter发送一个简单的请求来更新你的状态,我试过这个:http://pratham.name/twitter-php-script-without-curl.html,它有效.现在,我想用netcat发送此请求,但这不起作用,为什么?
我以这种方式发送请求:
echo -e $head | nc twitter.com 80
Run Code Online (Sandbox Code Playgroud)
$ head是我用PHP试过的标题,所以它是正确的.
谁知道我怎么能做到这一点?谢谢大家.
编辑.
head="POST http://twitter.com/statuses/update.json HTTP/1.1\r\n
Host: twitter.com\r\n
Authorization: Basic myname:passwordinbs64\r\n
Content-type: application/x-www-form-urlencoded\r\n
Content-length: 10\r\n
Connection: Close\r\n\r\n
status=mymessage";
echo -e $head | nc twitter.com 80
Run Code Online (Sandbox Code Playgroud) 我怎么能创建这个小脚本?
例如:
~$ script.sh -b my small string... other things -a other string -c any other string ant etc
Run Code Online (Sandbox Code Playgroud)
我只想要字符串,每个都有一个模式.
-b
my small string... other things
-a
other string
-c
any other string ant etc
Run Code Online (Sandbox Code Playgroud)
有谁知道如何实现它?
谢谢