/ Published in: JavaScript
Run in cmd with:
> CScript pingTechnorati.js BLOG_NAME BLOG_URL
> CScript pingTechnorati.js BLOG_NAME BLOG_URL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Technorati Ping // Sends out XML-RPC ping for blog updates to technorati (function technoratiPing() { WScript.Echo("Technorati Ping "); if(WScript.Arguments.length < 2) { WScript.Echo("Usage: BLOG_NAME BLOG_URL"); WScript.Quit(); } var blogName = WScript.Arguments.Item(0); var blogURL = WScript.Arguments.Item(1); var xmlBody = "<?xml version=\"1.0\"?>" + "<methodCall>" + " <methodName>weblogUpdates.ping</methodName>" + " <params>" + " <param>" + " <value>" + blogName + "</value>" + " </param>" + " <param>" + " <value>" + blogURL + "</value>" + " </param>" + " </params>" + "</methodCall>"; var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("POST", "http://rpc.technorati.com/rpc/ping",false); xmlhttp.setRequestHeader("Content-Type","text/xml"); xmlhttp.setRequestHeader("Content-Length","250"); xmlhttp.send(xmlBody); WScript.Echo(getResult(xmlhttp)); //Function to inspect the xml response and print out message. //@Warning make some assumtions about the xml format function getResult(request) { if (request.readyState == 4) { if (request.status == 200) { var outputBuffer = ""; var members = request.responseXML.getElementsByTagName("member"); for (var x=0; x < members.length; x++) { var name = members[x].childNodes[0].childNodes[0].nodeValue; var value = members[x].childNodes[1].childNodes[0].childNodes[0].nodeValue; outputBuffer += name + ":" + value + " "; } return outputBuffer; } } } })();
URL: http://technorati.com/developers/ping/