[Previous entry: "Trials and tribulations of running a dedicated webserver and web sites"] [Next entry: "Great site for comparing wiki software"]
05/19/2006: "XML-RPC to ping blog directories after an update"
I have been envious of some of the features of th wordpress software for some time. I use greymatter blogging software and I am planning to get all of the features available to other bloggers into greymatter.
One feature of some blogging tools is the ability to tell blog directories that you have added a post to your web log. The normal way I have been doing this is to manually go to various blog directories such as weblogs.com and post my update using the form. Then i found a great site called pingomatic that allows you to register your update using their form and then they ping a number of blog directories for you.
The way this works is by using xml-rpc. This allows remote procedure calls to be made using just HTTP. This is a great idea and was invented some years back. I have known for sometime that wordpress allows a user to configure which sites to ping in its interface so I downloaded wordpress to see how it works. After seeing the XML packet structure i searched to see if anyone had done the same on greymatter, but to no avail. I then searched wider to see if anyone had done it in perl. They had, I found Hans Kellner's page titled "Weblogs.Com Perl XML-RPC Ping Utility" and headed over there and downloaded his perl and modified it for my use.
I wanted to ping pingomatic instead as it then pings 16 other blog directories. So i modified Hans code and and also made it run as a web URL. The modified code is available on my site as xml-rpc.txt. Simply copy the file and rename it to xml-rpc.cgi and put it in your greymatter cgi-bin directory. change the name of the weblog at the top where it is indicated to fill it in. chmod the file to 755 and then run it as http://{path to greymatter cgi-bin}/xml-rpc.cgi. A sample run is here for my site:
Pinging rpc.pingomatic.com for weblog "Pete Finnigan's Web Development blog" at "http://web.petefinnigan.com/weblog/entries/index.html" (0) : Pings being forwarded to 16 services!
Thanks very much to Hans for making the code available and GPL'ing it so that i can redistribute a slightly modified version here.
A future mod would be to have a configuration file that allows a link of rpc sites to be added and then a ping sent to each. When I get time i will modify it to do this.