hook_ping

Versions
4.6 – 6
hook_ping($name = '', $url = '')

Ping another server.

This hook allows a module to notify other sites of updates on your Drupal site.

Parameters

$name The name of your Drupal site.

$url The URL of your Drupal site.

Return value

None.

Related topics

Code

developer/hooks/core.php, line 781

<?php
function hook_ping($name = '', $url = '') {
  $feed = url('node/feed');

  $client = new xmlrpc_client('/RPC2', 'rpc.weblogs.com', 80);

  $message = new xmlrpcmsg('weblogUpdates.ping',
    array(new xmlrpcval($name), new xmlrpcval($url)));

  $result = $client->send($message);

  if (!$result || $result->faultCode()) {
    watchdog('error', 'failed to notify "weblogs.com" (site)');
  }

  unset($client);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.