Learn WordPress
Home » Script

Perl xmlrpc Ping Script For WordPress MU

xmlrpc Ping

Update Services are tools you can use to let other people know you have updated your blogs. At WordPress automatically notifies popular Update Services that you have updated your blogs by sending a XML-RPC ping each time you create or update a new post.

In turn, Update Services process the ping and updates their proprietary indices with your update. Now people browsing sites like Technorati or Sphere can find your most recent posts!

WordPress (MU) ping is so annyoing, so I searched a little. Here is a nice and working PERL xmlrpc ping script, easy to put it into a cronjob or to use it with many sites.

The XMLRPC Lite package is included in Lite.

# rpcping.pl – Ping your blog with update services
# © Copyright, 2006 by John Bokma, http://johnbokma.com/
# License: The Artistic License
# $Id: rpcping.pl 1083 2008-09-30 19:06:18Z john $

use strict;
use warnings;

use XMLRPC::Lite;

sub print_usage_and_exit {

print <<USAGE;
usage: rpcping.pl “YOUR WEBLOG NAME” URL


@ARGV == 2 or print_usage_and_exit;
my ( $blog_name, $blog_url ) = @ARGV;

my @services = (

# See http://codex.wordpress.org/Update_Services for
# a more comprehensive list.
‘Google’ => ‘http://blogsearch.google.com/ping/RPC2′,
‘Weblogs.com’ => ‘http://rpc.weblogs.com/RPC2′,
‘Feed Burner’ => ‘http://ping.feedburner.com/’,
‘Moreover’ => ‘http://api.moreover.com/RPC2′,
‘Syndic8′ => ‘http://ping.syndic8.com/xmlrpc.php’ ,
‘BlogRolling’ => ‘http://rpc.blogrolling.com/pinger/’,
‘Technorati’ => ‘http://rpc.technorati.com/rpc/ping’ ,
‘BulkFeeds’ => ‘http://bulkfeeds.net/rpc’,
‘BlogFlux’ => ‘http://pinger.blogflux.com/rpc/’,
‘Ping-o-Matic!’ => ‘http://rpc.pingomatic.com/’,
‘NewsGator’ => ‘http://services.newsgator.com/ngws/xmlrpcping.aspx’,
‘Blog People’ => ‘http://www.blogpeople.net/servlet/weblogUpdates’,
‘Howly Cow Dude’ => ‘http://www.holycowdude.com/rpc/ping/’,
‘Blog Update’ => ‘http://blogupdate.org/ping/’,
‘FeedSky’ => ‘http://www.feedsky.com/api/RPC2′,

while ( my ( $service_name, $rpc_endpoint ) = splice @services, 0, 2 ) {

my $xmlrpc = XMLRPC::Lite->proxy( $rpc_endpoint );
my $call;
eval {
$call = $xmlrpc->call( ‘weblogUpdates.ping’,
$blog_name, $blog_url );
if ( $@ ) {

chomp $@;
warn “Ping ‘$service_name’ failed: ‘$@’\n”;

unless ( defined $call ) {

warn “Ping ‘$service_name’ failed for an unknown reason\n”;

if ( $call->fault ) {

chomp( my $message = $call->faultstring );
warn “Ping ‘$service_name’ failed: ‘$message’\n”;

my $result = $call->result;
if ( $result->{ flerror } ) {

warn “Ping ‘$service_name’ returned the following error: ‘”,
$result->{ message }, “‘\n”;

print “Ping ‘$service_name’ returned: ‘$result->{ message }’\n”;

The things with WPMU is that all the ping functionality of WP is included, but they have decided to not allow us users to add any more ping servers.. But a simple bit of PHP code can fix all this..

Try the following:

  1. Create a text file (must be called pinglist.txt) of all the ping servers you would like your wp blogs to ping
    something like:










  2. Using notepad, copy the following PHP code and save as wpmu-pinglist.php

    $mysql_server = DB_HOST;
    $mysql_username = DB_USER;
    $mysql_password = DB_PASSWORD;
    $mysql_database = DB_NAME;

    $pinglist = file(dirname(__FILE__).’/pinglist.txt’);

    // Connect to database
    $db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
    mysql_select_db($mysql_database, $db);

    $sql = “SELECT blog_id FROM wp_blogs order by blog_id asc;”;
    $sql = mysql_query($sql) or die(mysql_error().'<br>Line : ‘.__LINE__.'<br>’.$sql);
    while( $row = mysql_fetch_assoc($sql) )
    $blogid = $row[‘blog_id’];
    $q = “update wp_{$blog_id}_options set option_value=’$pingliststr’ where option_name=’ping_sites';”;
    mysql_query($q) or die(mysql_error().'<br>Line : ‘.__LINE__.'<br>’.$sql);
    echo ‘All Done!!!<br>';

  3. Now FTP both files up into the root directory of your blog, and then
    using your web browser, simply go:


  4. And within seconds (assuming you copied and pasted everything OK), you will now have a “pile” of ping servers attached to every blog.
    If you add a new blog, then simply run the script again..

FREE Cloud Storage