首页 航班查询 航班查询示例代码 航班城市[PHP]

航班城市示例代码[PHP]

作者: 阅读数:2224 上传时间:2018-06-07

航班城市

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$url = "https://api.jisuapi.com/flight/city?appkey=$appkey";

$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);

if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

$result = $jsonarr['result'];
foreach ($result as $val){
    echo $val['cityname'].' '.$val['citycode'].' '.$val['encityname'].' '.
        $val['letter'].' '.$val['country'].'
'; }