検索
ホームページphp教程php手册php webservice 接口 实例 机票航班时刻表

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





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



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




$city=$client->getDomesticCity();
$city=get_object_vars($city);  
$city=$city[&#39;getDomesticCityResult&#39;]->any;

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





$result=$client->getDomesticAirlinesTime($parm);
$result=get_object_vars($result);  
$result=$result[&#39;getDomesticAirlinesTimeResult&#39;]->any;
//print_r($result[&#39;getDomesticAirlinesTimeResult&#39;]->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>&#160;
                    
                </td>
            </tr>
            <tr>
                <td>
                    
                        </td>
            </tr>
            <tr>
                <td align="center">
                    <strong>WebXml.com.cn</strong><strong>
                         航班时刻表 Web Service 实例</strong></td>
            </tr>
            <tr>
                <td>&#160;
                    
                </td>
            </tr>
            <tr>
                <td>   
                </td>
            </tr>
            <tr>
                <td>&#160;
                    
                </td>
            </tr>
            <tr>
                <td>
                    <table width="100%" border="0" cellpadding="2" cellspacing="1" bordercolor="#FFFFFF"
                        bgcolor="#E5005A">
                        <tr>
                            <th  style="background-color: #FFD7E7;">
                                航空公司</th>
                            
                            <th style="width: 10%; background-color: #FFD7E7;">
                                航班编号</th>
                            <th style="width: 18%; background-color: #FFD7E7;">
                                出发机场</th>
                            <th style="width: 10%; background-color: #FFD7E7;">
                                出发时间</th>
                            <th style="width: 18%; background-color: #FFD7E7;">
                                到达机场</th>
                            <th style="width: 10%; background-color: #FFD7E7;">
                                到达时间</th>
                            <th style="width: 10%; background-color: #FFD7E7;">
                                机型</th>
                            <th style="width: 10%; background-color: #FFD7E7;">
                                中途是否停</th>
                        </tr>
                        
                             
                            <?php 
							
			foreach($obj_xml->children()->children() as $child)     
            {
               
			 ?>
             
         
                  
                                <tr>
                                    <td class="tdbg">
                                     <?php    echo $child->Company; ?>
                                     </td>
                                 
                                    <td class="tdbg" >
                                         <?php   echo $child->AirlineCode; ?>
                                    </td>
                                    <td class="tdbg" >
                                         <?php   echo $child->StartDrome; ?>
                                    </td>
                                    <td class="tdbg">
                                        <?php   echo $child->StartTime; ?>
                                    </td>
                                    <td class="tdbg">
                                        <?php   echo $child->ArriveDrome; ?>
                                    </td>
                                    <td class="tdbg">
                                       <?php   echo $child->ArriveTime; ?>
                                    </td>
                                    <td class="tdbg">
                                        <?php   echo $child->Mode; ?>
                                    </td>
                                    <td class="tdbg">
                                       <?php if($child->AirlineStop==0)  echo &#39;不停&#39;;else{echo &#39;停&#39;;} ?>
                                    </td>
                                </tr>
                           
                            <?php  }?>
                    </table>
                </td>
            </tr>
      
        </table>

</body>
</html>

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター