I have found this little script in PHP that send a simple request to twitter for update your status, I have tried this: http://pratham.name/twitter-php-script-without-curl.html, and it work. Now, I want send this request with netcat, but this doesn’t work, why?
I send request in this way:
echo -e $head | nc twitter.com 80
The $head are my header that I have tried with also PHP, so it are right.
Anyone know how I can make this? Thanks to all.
edit.
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
The data you send is not correct. Here’s the command I’m executing:
I’m running a tcpdump in parallel and here is what it shows me:
Do you see the mistake? At each line break are three characters, but there should be only two. This happens because you have a real line break in your variable definition that becomes a space in the shell. E.g.
Try writing it all in one line instead.