首页 > 代码库 > php webservice 接口 实例 机票航班时刻表

php webservice 接口 实例 机票航班时刻表

<?php
header('Content-Type: text/html; charset=UTF-8');
$client = new SoapClient('http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl');	





$fromcity=!empty($_POST['fromcity']) ? trim($_POST['fromcity']) : '长沙';
$tocity=!empty($_POST['tocity']) ? trim($_POST['tocity']) : '广州';
$date=!empty($_POST['date']) ? trim($_POST['date']) : date('Y-m-d',time());



$parm=array(
'startCity'=>$fromcity,
'lastCity'=>$tocity,
'theDate'=>$date,
'userID'=>''
);




$city=$client->getDomesticCity();
$city=get_object_vars($city);  
$city=$city['getDomesticCityResult']->any;

//print_r($city);
//var_dump($city);
$city_xml = simplexml_load_string($city); 





$result=$client->getDomesticAirlinesTime($parm);
$result=get_object_vars($result);  
$result=$result['getDomesticAirlinesTimeResult']->any;
//print_r($result['getDomesticAirlinesTimeResult']->any);


$obj_xml = simplexml_load_string($result);  
//print_r($obj_xml->children()->children());   
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>WecXml.com.cn 火车时刻表 Web Service 实例</title>
<style type="text/css">
<!--
@import url("css/c.css");
-->

</style>

</head>
<body>


  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td> 
                    
                </td>
            </tr>
            <tr>
                <td>
                    <a href=http://www.mamicode.com/"http://www.webxml.com.cn/">>