drupal 7 menu return global results

57 views Asked by At

i have one drupal menu, its page callback is best_quote, and file is handle.php.inc. the content of the handle.php.inc is:

<?php

function best_quote(){
$token=get_token('RT1IADDOH2014-01-20T00:00:00DOHIAD2014-03-05T00:00:00NAENNN100QR0000USD');
get_search_results($token);
$results=get_search_results($token);
return $results;
}



 function get_token($entry){
    $client = new SoapClient();
    $result=$client->do_LowfareSearch(array('rq'=>$array));// return the token
    $token= $result->do_LowfareSearchResult;
    return $token;

 }
function get_search_results($token){
    $client = new SoapClient();
    $polling_array=array();
    $polling_array['rid']=$token;
    $response= $client->do_Polling($polling_array);
    $results= $response->do_PollingResult;
    $xml = simplexml_load_string($results);
    $json = json_encode($xml);
    $array = json_decode($json,TRUE);
            $search_results_first_part=$array["PricedItineraries"]['PricedItinerary'];
    $priced_itineraries_count= count($search_results_first_part);
    if($priced_itineraries_count==0){
        get_search_results($token);
    }else if($priced_itineraries_count==4){
        get_search_results($token);
    }else {
    return $xml;

}

 }

In best_quotes() function, i want to return the results,but the page is blank. Do you know what's wrong? Thank.

1

There are 1 answers

0
user1611237 On

i found the problem: in the if condition, we have to return get_search_results($token); when there is nothing to return.