Until now I'm calling a web service with using specific function like hook_user_logout, _validate, _submit..., but now I need to create a page that will display details that I'll receive results from the web service, but I don't know how to call when I enter lets say user/%/reports.

Also on that page there will be a link that will display more details that will come from the webservice.

Is there a function for page load, url open or something similar in Drupal 7?

Here's my part of the code when a user logouts.


function mymodyle_user_logout($account) {

    global $user;

    $username = $user -> name;
    $ip_address = $_SERVER["REMOTE_ADDR"];
    $session_id = session_id();

    $xml_string = '<some_method>
       <username>' . $username . '</username>
       <ip_address>' . $ip_address . '</ip_address>
       <session_id>' . $session_id . '</session_id>

    $client = new nusoap_client('',  array('soap_version' => SOAP_1_1, 'trace' => 1, 'exeptions' => true));
    $client -> soap_defencoding = 'UTF-8';
    $client -> decode_utf8 = FALSE;

    $result = $client -> call('Logout', array('_xml' => $xml_string));

    //$response = simplexml_load_string($result['LogoutResult']);

    //$status = $response -> error->descr_bg;


1 Answer 1


If the page content needs to be fetched via an API request, you can use


to define a URL path to function callback to generate the page content.

Basically your own path to the content.

The page callback will fetch the API response from cache or perform the request, cache the response and display it.

  • What if the page is already created with Views? let's say user/%/edit? Jan 30, 2014 at 9:47
  • 1
    Then you can add a custom block to that page and return the content within that block instead, more info on the Block API Jan 30, 2014 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.