You are here

function xmlrpc_example_info in Examples for Developers 7

A simple landing-page information function.

Related topics

1 string reference to 'xmlrpc_example_info'
xmlrpc_example_menu in xmlrpc_example/xmlrpc_example.module
Implements hook_menu().

File

xmlrpc_example/xmlrpc_example.module, line 85
Module file for xmlrpc_example module.

Code

function xmlrpc_example_info() {
  $server = url($GLOBALS['base_url'] . '/xmlrpc.php', array(
    'external' => TRUE,
  ));
  $options = array(
    'system.listMethods' => array(),
  );

  // Make the xmlrpc request and process the results.
  $supported_methods = xmlrpc($server, $options);
  if ($supported_methods === FALSE) {
    drupal_set_message(t('Error return from xmlrpc(): Error: @errno, Message: @message', array(
      '@errno' => xmlrpc_errno(),
      '@message' => xmlrpc_error_msg(),
    )));
  }
  return array(
    'basic' => array(
      '#markup' => t('This XML-RPC example presents code that shows <ul><li><a href="!server">XML-RPC server code</a></li><li><a href="!client">XML-RPC client code</a></li><li>and <a href="!alter">an example hook_xmlrpc_alter() call</a></li></ul>', array(
        '!server' => url('examples/xmlrpc/server'),
        '!client' => url('examples/xmlrpc/client'),
        '!alter' => url('examples/xmlrpc/alter'),
      )),
    ),
    'method_array' => array(
      '#markup' => theme('item_list', array(
        'title' => t('These methods are supported by !server', array(
          '!server' => $server,
        )),
        'items' => $supported_methods,
      )),
    ),
  );
}