同时更新 renren与twitter状态的bash脚本。
对于renren网,使用curl模拟登录与提交。
之与twiiter则使用curl直接调用其api提交。
#!/bin/bash
CURL=/usr/bin/curl
COOKIE=/tmp/renren.cookie
STATUS=$1
RRUSER=renren username
RRPASS=renren password
TWUSER=twitter username
TWPASS=twitter password
${CURL} -d "email=${RRUSER}&password=${RRPASS}" "http://passport.renren.com/PLogin.do" -c ${COOKIE} -L -s >> /dev/null
RESPONSE=`${CURL} -d "c=${STATUS}&raw=${STATUS}&isAtHome=1" "http://status.renren.com/doing/update.do?" -e "http://status.renren.com/ajaxproxy.htm" -b ${COOKIE} -L -s`
#echo ${RESPONSE}
echo "Update renren.com"
if echo ${RESPONSE}|grep -q "updateStatusId"
then
echo "successful"
else
echo "fail"
fi
RESPONSE=`${CURL} -u "${TWUSER}:${TWPASS}" -d status="${STATUS}" https://twitter.com/statuses/update.xml -s`
#echo ${RESPONSE}
echo "Update twitter.com"
if echo ${RESPONSE}|grep -q "status"
then
echo "successful"
else
echo "fail"
fi
Related posts:





#1 by jinuljt on 27/01/2010 - 19:09
renren.com 新增一个post项。
参见http://jinu.me/index.php/2010/01/twitter-sina-renren-update-in-sametime/
#2 by amoblin on 27/01/2010 - 16:43
code:3
fail
why?