Untuk mengupdate status twitter lewat shell script sebenarnya kita hanya menggunakan HTTP request. Perintah yang digunakan adalah POST(bukan metode HTTP) atau nama lainnya lwp-request sebuah perl script yang hampir semua distribusi pasti ada. OK langusng aja kita praktikan bagaimana caranya.
#!/bin/bash
#
TUNAME="lesstalkme"
TUPASS=""
TSTATUS=""
TURL="http://twitter.com/statuses/update.xml"
TDATA="source=LTME&status="
# print some fancy header :)
echo "-----------------------------------------"
echo " Twitter Status Updater"
echo " http://www.less-talk-more-example.info/"
echo "------------------------------------------"
echo -n "Twitter Password: "
read -ers TUPASS
echo -e "\nEnter Twitter Status:"
read TSTATUS
# replace some characters ( I"m too lazy to replace all the characters :))
TSTATUS=`echo $TSTATUS | sed "s/ / /g"` # space =>
TSTATUS=`echo $TSTATUS | sed "s/@/@/g"` # @ => @
TSTATUS=`echo $TSTATUS | sed "s/\////g"` # / => /
TSTATUS=`echo $TSTATUS | sed "s/:/:/g"` # : => ;
TSTATUS=`echo $TSTATUS | sed "s/#/#/g"` # # => #
# now POST the data
echo ""
echo -n "Updating status..."
echo "${TDATA}${TSTATUS}" | POST -C casino $TUNAME:$TUPASS $TURL | grep $TUNAME > /dev/null
# check status
# ------------
# successfull request always return XML format that containts our username
# so we grep that to check the status
if [ $? -eq 0 ]; then
echo "DONE."
else
echo "ERROR."
fi
$ cd /tmp
$ chmod x twitter.sh
$ ./twitter.sh
twitter.sh.zip via ziddu.com.
Size: 0.69kb
MD5 Checksum: f9d38c632430a617331cc4f8d298fcf1
Untuk melihat video screencast dari tutorial ini klik http://lug.stikom.edu/2010/02/screencast-update-twitter-status-via-shell-script/
Sumber:
http://www.less-talk-more-example.info/2010/02/update-twitter-status-via-shell-script.html
49 Comments
bester blog plastischer chirurgie
Elizabeth Ruby is passionate about good health and using healthy products on her skin.
Harris isn’t the only TV personality who has gotten plastic surgery after feeling pressured to
change her looks. Between the two incisions, the tissue of the lower back is then mobilized as flaps for
enhancement of the upper buttock region.
descarga
He leído tus artículos dos veces queriendo hallar algo diferente y
la realidad es que de esta manera pasa. Cada que leo tus artículos encuentro
algo nuevo. Te juro que llevo no menos de tres horas leyendo cada una de las cosas que has escrito y me semejan geniales.
Espero que no creas que intento acosarte jeje.
Esta vez en serio, quiero decirte que es una grata experiencia poder encontrarme con gente que tiene grandes habilidades con las letras.
Espero que sigas de esta manera y que si se da el momento, podamos conocernos.
Saludos!
h10 voucher codes
Fantastic beat ! I ish to apprentice while you amend your site, how can i subscribe for a blog
web site? The account helped me a acceptable deal. I had
been tiny bit acquainted of this your broadcast offered bright clear concept
yankodesign.com
Fantastic beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog web site?
The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast
provided bright clear concept
Post a Comment