首页 电视节目预告 电视节目预告示例代码 电视节目查询[PHP]

电视节目查询示例代码[PHP]

作者: 阅读数:2157 上传时间:2016-03-10

电视节目查询

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$tvid = 435;
$date = '2015-10-19';
$url = "https://api.jisuapi.com/tv/query?appkey=$appkey&tvid=$tvid&date=$date";
$result = curlOpen($url, ['ssl'=>true]);

$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));

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

$result = $jsonarr['result'];
echo $result['tvid'].' '.$result['name'].' '.$result['date'].'
'; foreach($result['program'] as $val) { echo $val['prizename'].' '.$val['name'].' '.$val['starttime'].'
'; }