Weblogs.com Ping Cacher in PHP

Like many other weblogging systems, ours sends an XML-RPC ping to Weblogs.com whenever a new item appears. Weblogs.com is a busy server though, and when we do this is “real time” there’s an 5 or 10 second delay before the ping is finished during which authors have to sit and wait.

As a way of working around this, we’ve set up a “ping cacher.” Ping requests are dumped into a MySQL database by the weblog authoring system, and then a cron job does the actual pinging, checking once a minute to see if there’s any new items deserving of a ping.

To keep things simple and universal, we set up our own XML-RPC server that mirrors exactly the XML-RPC parameter format of the Weblogs.com web service at rpc.weblogs.com/RPC2. Ours lives at www.reinvented.net/RPC2 and, just like Weblogs.com, accepts a request with two parameters, weblogname and weblogurl.

Pings to our XML-RPC service are dumped into a MySQL database, and then a cron job checks once a minute for new items that haven’t had a ping sent for them; if the cron jobs finds one, it sends an XML-RPC message to the rpc.weblogs.com/RPC2 and marks the item in the database as having been “pinged for.”

We used the useful inc. PHP XML-RPC implementation (update: this code has moved here, and recent changes may require tweaks to the function names in my code) to build the server and the client.

We’re making the code available under a Creative Commons Attribution-ShareAlike license:

There are two scripts included: index.php is the XML-RPC server that mimics the Weblogs.com ping server and ping.php, which assumes you have installed a CGI version of PHP, runs as a cron job.

Our implementation assumes you use MySQL as a database server, but of course it would be easy to substitute any database server with a few modifications.


Peter Rukavina's picture
Peter Rukavina on July 6, 2003 - 02:08 Permalink

One explanatory note that I left out: it would, of course, be much simpler to have the weblog authoring tool simply dump the “ping cache” into a database itself. I wanted to be able to offer ping caching to blog neighbours, though, and only require them to change the address of the XML-RPC server to do so. That’s why I set things up as I did.

Brad Pineau's picture
Brad Pineau on August 22, 2003 - 01:21 Permalink

If you don’t mind Peter, I think I’ll use your pinging system instead of pinging Weblogs.com. You weren’t kidding when you said it has a busy server.

Thanks a lot.

Del's picture
Del on January 1, 2006 - 16:52 Permalink

Hi Peter,

I just downloaded your XML-RPC server today — found it in a google search.

I noticed you published this over 2 years ago!! Do you have any updates as the links are now dead in this article

Shamar's picture
Shamar on December 29, 2009 - 04:58 Permalink

I am almost intrigued by this topic and would like to learn more. Could you please recommend some book to begin with? I have found many articles and periodical at http://www.pdfqueen.com pdf books and periodical search engine, but am not sure if it is all worth reading. Thank you for your advice.

You must have Javascript enabled to use this form.