Ping.module

|

The ping module is used to notify other sites that you have new content.
This can be pretty important to tell the world that your site has been updated, so your sites updates can be indexed.

However the default ping.module seems to only ping the service provided by http://pingomatic.com/.
Which in turn is suppose (could be unavailable) to ping others index engines.
I'd like to ping directly whoever I want, so I'm currently research how to do just that.
I'm a software engineer but new to PHP so my approach here is to make recommendations from a none PHP developer type.

1) First if you want to know the ping went will add the following to your ping module:
Change:
".../..
function ping_ping($name = '', $url = '') {
$result = xmlrpc('http://rpc.pingomatic.com', 'weblogUpdates.ping', $name, $url);
if ($result === FALSE) {
watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING);
}
}
.../..."
To:
".../..
function ping_ping($name = '', $url = '') {
$result = xmlrpc('http://rpc.pingomatic.com', 'weblogUpdates.ping', $name, $url);
if ($result === FALSE) {
watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING);
}
else {
watchdog("directory ping", t('successfully notified pingomatic.com (site).'), WATCHDOG_NOTICE);
}
}
.../..."

2) As an exercie I will now add a ping to http://technorati.com.
http://technorati.com/developers/ping/
Modify the function ping_ping($name = '', $url = '') function at the bottom of the ping.module file.
Add:
unset($result);
$result = xmlrpc('http://rpc.technorati.com/rpc/ping', 'weblogUpdates.ping', $name, $url);
if ($result === FALSE) {
watchdog('directory ping', t('Failed to notify technorati.com (site).'), WATCHDOG_WARNING);
}
else {
watchdog("directory ping", t('successfully notified technorati.com (site).'), WATCHDOG_NOTICE);
}
unset($result);

Adding a series of these for your difference ping targets.

I think someone will probably soon rewrite this module to make the options more configurable.
So keep visiting the Drupal 3rd party modules or maybe even the official modules.

PHP note:
unset() destroys the specified variables. Note that in PHP 3, unset() will always return TRUE (actually, the integer value 1). In PHP 4, however, unset() is no longer a true function: it is now a statement. As such no value is returned, and attempting to take the value of unset() results in a parse error.

Reference:
http://drupal.org/node/31334
http://drupal.org/node/29704
http://drupal.org/node/44822
http://drupal.org/node/12498
http://us2.php.net/unset