|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
/*
|
|
|
|
|
* 机票API接口
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class Flightapi {
|
|
|
|
|
|
|
|
|
|
var $CI;
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
|
$this->CI = & get_instance();
|
|
|
|
|
//$this->CI->load->library('Currency');
|
|
|
|
|
}
|
|
|
|
|
////////////// 携程API ///////////////////
|
|
|
|
|
//国内机票查询
|
|
|
|
|
public function ctrip_flight($form_city,$to_city,$flight_date,$search_type='S',$return_date=false,$departport=false,$arriveport=false) {
|
|
|
|
|
require_once("API/CtripUnion.php");
|
|
|
|
|
$cu = new CU('flight', 'OTA_FlightSearch');
|
|
|
|
|
$data = array('from_city' => $form_city, 'to_city' => $to_city, 'date' => $flight_date, 'search_type' => $search_type, 'return_date'=>$return_date, 'departport'=>$departport, 'arriveport'=>$arriveport);
|
|
|
|
|
//第二个参数为返回类型参数,支持string,json,xml,array,object,缺省默认执行对应方法中的respond_xml
|
|
|
|
|
$result_data = $cu->OTA_FlightSearch($data, 'object');
|
|
|
|
|
//var_dump($result_data);
|
|
|
|
|
return($result_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//国际机票
|
|
|
|
|
|
|
|
|
|
public function international_flight($form_city,$to_city,$flight_date,$returndate=false,$order_name=false,$order_type=false,$route_rearch_token=false){
|
|
|
|
|
require_once("API/CtripUnion.php");
|
|
|
|
|
$cu = new CU('flight', 'OAE_IntlFlightSearch');
|
|
|
|
|
$data['intflight_form_city'] = $form_city;
|
|
|
|
|
$data['intflight_to_city'] = $to_city;
|
|
|
|
|
$data['intflight_date'] = $flight_date;
|
|
|
|
|
$data['return_date'] = $returndate;
|
|
|
|
|
if ($order_name)
|
|
|
|
|
$data['order_name'] = $order_name;
|
|
|
|
|
if ($order_type)
|
|
|
|
|
$data['order_type'] = $order_type;
|
|
|
|
|
if($route_rearch_token) $data['route_rearch_token']=$route_rearch_token;
|
|
|
|
|
//第二个参数为返回类型参数,支持string,json,xml,array,object,缺省默认执行对应方法中的respond_xml
|
|
|
|
|
$result_data = $cu->OAE_IntlFlightSearch($data, 'object');
|
|
|
|
|
return($result_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////// 携程API ///////////////////
|
|
|
|
|
}
|