Thread subject: Explore Your Brain :: update status twitter via TERMINAL

Posted by ayam-kalkun on 17-02-2010 17:01
#1


Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29
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 lets cek it out.

i818.photobucket.com/albums/zz107/iqbalsipenguinkecil/TU-1.jpg

Code

#!/bin/bash
#
TUNAME="User name kamu"
TUPASS="Password kamu"
TSTATUS=""
TURL="http://twitter.com/statuses/update.xml"
TDATA="source=LTME&status="
 
# print some fancy header :)
echo "-----------------------------------------"
echo "         Twitter Status Updater"
echo " http://www.exploreyourbrain.com/"
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/ /%20/g'` # space => %20
TSTATUS=`echo $TSTATUS | sed 's/@/%40/g'` # @ => %40
TSTATUS=`echo $TSTATUS | sed 's/\//%2F/g'` # / => %2F
TSTATUS=`echo $TSTATUS | sed 's/:/%3A/g'` # : => %3B
TSTATUS=`echo $TSTATUS | sed 's/#/%23/g'` # # => %23
 
# now POST the data
echo ""
echo -n "Updating status..."
echo "${TDATA}${TSTATUS}" | POST -C $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





Ganti TUNAME dan TUPASS dengan username dan password kamu sendiri.

Simpan ke satu directory misal /home.

Beri nama tu.sh (atou terserah yang penting exkensinya .sh harus .sh okey..)

Buka terminal System Application Terminal atau alt+f2 x-terminal-emulator

Masuk ke /home direktori dan berikan permission execute pada file tersebut.
[/code]
$ cd /home
$ chmod +x tu.sh

Eksekusi file tersebut, kamu akan ditanya password dan status kamu.
Code

$ ./tu.sh





i818.photobucket.com/albums/zz107/iqbalsipenguinkecil/TU-1.jpg

i818.photobucket.com/albums/zz107/iqbalsipenguinkecil/TU2.png


Setelah itu maka status twitter kamu telah terupdate :).

i818.photobucket.com/albums/zz107/iqbalsipenguinkecil/TU1.png

click gambar untuk memperbesar..

Edited by ayam-kalkun on 26-02-2010 03:13