Revision: 18851
Updated Code
at October 9, 2009 19:20 by jasonseney
Updated Code
// 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; } } } })();
Revision: 18850
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 9, 2009 19:19 by jasonseney
Initial Code
(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; } } } })();
Initial URL
http://technorati.com/developers/ping/
Initial Description
Run in cmd with: > CScript pingTechnorati.js BLOG_NAME BLOG_URL
Initial Title
Technorati Ping - JScript WSH (javascript with XMLHTTP)
Initial Tags
Initial Language
JavaScript