hook_ping
Definition
hook_ping($name = '', $url = '')
developer/hooks/core.php, line 1042
Description
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
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
Code
<?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);
}
?> 