» Utilizator
LAMP
» Parteneri» De citit» Recomandari» Taskuri securitate » Statistici
  • 65571 de mesaje.
  • 7753 de topicuri.
  • 1305 de utilizatori.
  •  
  • allerhoofNole e ultimul utilizator inregistrat.
[Detalii]

 

| |
Pagini: [1]
Print

[BASH]Updating twitter via cURL [496 afisari]

zapakitul
*


Mesaje: 1930
OfflineOffline

WWW

Citeam niste articole pe lamp.ro si am dat din intamplare peste un 'articol' referitor la "updatarea statusului de twitter folosind cURL". Nu m-am putut abtine sa nu incerc si eu ceva. Rezultatul, il aveti mai jos.

Code:
#!/bin/bash
#script posted on [url=http://www.zapakitul.wordpress.com]www.zapakitul.wordpress.com[/url]

echo "Twitter Terminal :: Update twitter with your computer data."
while [ 1 ]
do
[ -f /proc/meminfo ] &MEMUSED="$(( ( ( ( $MemTotal - $MemFree ) - $Cached ) - $Buffers ) / 1024 ))"
MEMTOTAL="$(( $MemTotal / 1024))"
MEMFREE="$(( $MEMTOTAL - $MEMUSED ))"
MEMPER="$(( ( $MEMUSED * 100 ) / $MEMTOTAL ))"
echo "Commands: send, send_dm, brake, update.Memory"
read var_command
if [ $var_command == "update.Memory" ]; then
curl -u twitter_username:twitter_password -d status="Total memory: $MEMTOTAL mb, Unused memory: $MEMFREE mb, " http://twitter.com/statuses/update.xml;
fi
if [ $var_command == "send" ]; then
echo "Type jur tweet nao, mortal: "
read tweet
curl -u twitter_username:twitter_password -d status="$tweet" http://twitter.com/statuses/update.xml;
echo "Your tweet has been send"
fi
if [ $var_command == "send_dm" ]; then
echo "Receiver username: "
read receiver
echo "Message: "
read tweet
curl -u twitter_username:twitter_password -d user="$receiver" -d text="$tweet" http://twitter.com/direct_messages/new.xml
echo "Sent"
fi
if [ $var_command == "brake" ]; then
exit
fi
done
Logged

05-10-2009, 15:35 Twitt ::
[]Adri4n
*


Mesaje: 43
OfflineOffline


Code:
#!/bin/bash
user="user-ul tau"
pass="parola ta"
curl="/usr/bin/curl"

$curl --basic --user "$user:$pass" --data-ascii \
  "status=`echo $@ | tr ' ' '+'`" \
    "http://twitter.com/statuses/update.json"

exit 0
Am incercat si eu ceva.
Logged
19-11-2009, 21:58 Twitt ::
Pagini: [1]
Print
SkullBox Forum  |  Development  |  Scripting  |  Topic: [BASH]Updating twitter via cURL