XML RPC with bash/netcat


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. # ping technorati
  4.  
  5. #set -v
  6.  
  7. # configuration
  8. ADDRESS="http://www.acooke.org/cute"
  9. NAME="C[omp]UTE"
  10. # (end of configuration)
  11.  
  12. export PATH="$PATH:$CUTE_DIR/scripts"
  13.  
  14. tmp=`mktemp`
  15. echo "<?xml version=\"1.0\"?>
  16. <methodCall>
  17. <methodName>weblogUpdates.ping</methodName>
  18. <params>
  19. <param>
  20. <value>$NAME</value>
  21. </param>
  22. <param>
  23. <value>$ADDRESS</value>
  24. </param>
  25. </params>
  26. </methodCall>" > "$tmp"
  27.  
  28. size=`cat "$tmp" | wc -c`
  29.  
  30. msg=`mktemp`
  31. echo "POST /rpc/ping HTTP/1.0
  32. User-Agent: bash script across netcat - andrew@...
  33. Host: rpc.technorati.com
  34. Content-Type: text/xml
  35. Content-length: $size
  36. " > "$msg"
  37.  
  38. cat "$tmp" >> "$msg"
  39. rm "$tmp"
  40. cat "$msg"
  41. cat "$msg" | nc rpc.technorati.com 80
  42. rm "$msg"

URL: bash_xmlrpc

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.