Weblogs.com Ping Cacher in PHP

Peter Rukavina

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.

Comments

Submitted by Peter Rukavina on

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.

Submitted by Brad Pineau on

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.

Submitted by Del on

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

Submitted by Shamar on

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.

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). You can subscribe to an RSS feed of posts, an RSS feed of comments, or receive a daily digests of posts by email.

Search