| Versions | |
|---|---|
| 4.7 – 6 | hook_ping($name = '', $url = '') |
Ping another server.
This hook allows a module to notify other sites of updates on your Drupal site.
$name The name of your Drupal site.
$url The URL of your Drupal site.
None.
developer/
<?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);
}
?>