Posts Tagged curl

同时更新renren与twitter

同时更新 renren与twitter状态的bash脚本。

对于renren网,使用curl模拟登录与提交。
之与twiiter则使用curl直接调用其api提交。

  1. #!/bin/bash
  2. CURL=/usr/bin/curl
  3. COOKIE=/tmp/renren.cookie
  4. STATUS=$1
  5. RRUSER=renren username
  6. RRPASS=renren password
  7. TWUSER=twitter username
  8. TWPASS=twitter password
  9. ${CURL} -d "email=${RRUSER}&password=${RRPASS}" "http://passport.renren.com/PLogin.do"   -c ${COOKIE} -L -s  >> /dev/null
  10. 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`
  11. #echo ${RESPONSE}
  12. echo "Update renren.com"
  13. if echo ${RESPONSE}|grep -q "updateStatusId"
  14. then
  15. echo "successful"
  16. else
  17. echo "fail"
  18. fi
  19.  
  20. RESPONSE=`${CURL} -u "${TWUSER}:${TWPASS}" -d status="${STATUS}" https://twitter.com/statuses/update.xml -s`
  21. #echo ${RESPONSE}
  22. echo "Update twitter.com"
  23. if echo ${RESPONSE}|grep -q "status"
  24. then
  25. echo "successful"
  26. else
  27. echo "fail"
  28. fi

, ,

2 Comments