This code snippet will probably be of interest to about 3 4 5 people in the entire world (counting myself).
If you have a home grown weblog (like this one) implemented using classic ASP and you want to ping Technorati with updates, then here's the snippet for you.
Incidentally, this is my Technorati Profile (claim code: Technorati Profile)
Technorati have an XML RPC that allows you to notify their backend systems that your weblog has been updated.
They then send one of their bots to read your website to update their databases.
For Technorati's page about doing your own pinging, visit: http://www.technorati.com/developers/ping/
You contact the RPC's endpoint via HTTP at the URL: http://rpc.technorati.com/rpc/ping
To send data, you must perform a HTTP Post containing XML that looks like this:
The routine is light on error handling, but it does the business.
If you have a home grown weblog (like this one) implemented using classic ASP and you want to ping Technorati with updates, then here's the snippet for you.
Incidentally, this is my Technorati Profile (claim code: Technorati Profile)
Technorati have an XML RPC that allows you to notify their backend systems that your weblog has been updated.
They then send one of their bots to read your website to update their databases.
For Technorati's page about doing your own pinging, visit: http://www.technorati.com/developers/ping/
You contact the RPC's endpoint via HTTP at the URL: http://rpc.technorati.com/rpc/ping
To send data, you must perform a HTTP Post containing XML that looks like this:
<?xml version="1.0"?>
<methodCall>
<methodName>weblogUpdates.ping</methodName>
<params>
<param>
<value>YOUR WEBLOG NAME HERE</value>
</param>
<param>
<value>http://www.YOURWEBLOGURL.com/</value>
</param>
</params>
</methodCall>
This ASP code snippet defines a function that performs the ping and calls it.The routine is light on error handling, but it does the business.
option explicit
' ensure that this script runs every time
Response.Expires = -1
Response.CacheControl = "private"
' do the ping, and keep the response
dim strData
strData = PingTechnorati("My Weblog Title", "http://www.myweblog.com/")
' output the response (encoded as HTML to humans can see the XML)
Response.Write Server.HTMLEncode(strData)
' a reusable pinging function
function PingTechnorati(byval strBlogName, byval strBlogUrl)
dim objXml, objHttp, strData, strReturn
' build ping XMLRPC call
strData = "<?xml version=""1.0""?>"
strData = strData & "<methodCall>"
strData = strData & "<methodName>weblogUpdates.ping</methodName>"
strData = strData & "<params>"
strData = strData & "<param>"
strData = strData & "<value>" & XmlSafe(strBlogName) & "</value>"
strData = strData & "</param>"
strData = strData & "<param>"
strData = strData & "<value>" & XmlSafe(strBlogUrl) & "</value>"
strData = strData & "</param>"
strData = strData & "</params>"
strData = strData & "</methodCall>"
' post to technorati XMLRPC ping URL
set objHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
objHttp.open "POST", "http://rpc.technorati.com/rpc/ping", false
objHttp.setRequestHeader "Content-Type", "text/xml"
objHttp.setRequestHeader "Content-Length", len(strData)
objHttp.Send strData
' check response
if (objHttp.status = 200) then
strReturn = objHttp.responseText
end if
' thanks, bye
set objHttp = nothing
' passback
PingTechnorati = strReturn
end function
' escape special XML characters
function XmlSafe(byval strData)
strData = replace(strData, "&", "&")
strData = replace(strData, "'", "'")
strData = replace(strData, """", """)
strData = replace(strData, "<", "<")
strData = replace(strData, ">", ">")
XmlSafe = strData
end function
Choking Hazard: Because the input parameters to the function are combined to form an XML string it would be possible to create invalid XML, the XmlSafe function makes sure that the basic special XML characters < > & ' and " are escaped in the proper XML way.3 comments,
Web, Thursday, July 28, 2005 23:22


