[GET] Perl xmlrpc ping script

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:

Step 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 :
Code:
http://1470.net/api/ping
http://a2b.cc/setloc/bp.a2b
http://api.feedster.com/ping
http://api.moreover.com/RPC2
http://api.my.yahoo.co.jp/RPC2
http://api.my.yahoo.com/rss/ping
http://audiorpc.weblogs.com/RPC2
http://bitacoles.net/ping.php
http://blog.goo.ne.jp/XMLRPC

Step 2:

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

Code:
<?php
require_once(dirname(__FILE__).'/wp-config.php');
$mysql_server			= DB_HOST;
$mysql_username			= DB_USER;
$mysql_password			= DB_PASSWORD;
$mysql_database			= DB_NAME;

$pinglist = file(dirname(__FILE__).'/pinglist.txt');
$pingliststr=trim(implode("\n",$pinglist));

// 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>';
?>

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

Code:
htttp://www.your-wpmu-blog-site.com/wpmu-pinglist.php

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..

Hope this helps
 
Back
Top