<?php
// +----------------------------------------------------------------------
// | 竞彩足球混合过关赔率API调用示例代码 - 麦趣数据
// | 在线接口文档:http://www.Matchodds.info
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://Matchodds.info
// +----------------------------------------------------------------------
// | Author: 麦趣数据 < QQ:2578620058 -->
// | Info: 本接口为api演示
// +----------------------------------------------------------------------
header('Content-type:text/html;charset=utf-8');
$host="http://120.79.248.89/apidemo/football/";
$method = "GET"; //GET/POST
//$querys = "mid=110188"; //指定单场赛事
$appkey="ApiD08D636E54F031E63FeBF8D1a2N9e"; //AppKey
$url = $host . "?" . $querys."&appkey=".$appkey;
//curl验证
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
'Content-Type: application/json',
));
$result = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
curl_close($ch);
//echo $result;
$obj=json_decode($result, true);
if($obj['code']=='200'){ echo "请求成功
";
foreach ( $obj['data'] as $arr ){
$mid = $arr['mid']; //赛事ID
$num = $arr['num']; //场次(例:1001 = 周一001)
$dtime = $arr['dtime']; //比赛时间
$l_id = $arr['l_id']; //联赛ID
$l_cn = $arr['l_cn']; //联赛名称
$h_id = $arr['h_id']; //主队ID
$h_cn = $arr['h_cn']; //主队名称
$a_id = $arr['a_id']; //客队ID
$a_cn = $arr['a_cn']; //客队名称
$status = $arr['status']; //赛事状态1正常0停售
$p_status = $arr['p_status']; //盘口状态1正常0停售顺序(胜平负,让球胜平负,比分,总进球,半全场)
$p_single = $arr['p_single']; //单关1是0否顺序(胜平负,让球胜平负,比分,总进球,半全场)
$p_goal = $arr['p_goal']; ////让球数顺序(胜平负,让球胜平负,比分,总进球,半全场)
$had_odds = $arr['had_odds']; //胜,平,负赔率
$hhad_odds = $arr['hhad_odds']; //让球胜,平,负赔率
$crs_win = $arr['crs_win']; //比分胜赔率(1:0,2:0,2:1,3:0,3:1,3:2,4:0,4:1,4:2,5:0,5:1,5:2,胜7+)
$crs_draw = $arr['crs_draw']; //比分平赔率(0:0,1:1,2:2,3:3,平7+)
$crs_lose = $arr['crs_lose']; //比分负赔率(0:1,0:2,1:2,0:3,1:3,2:3,0:4,1:4,2:4,0:5,1:5,2:5,负7+)
$ttg_odds = $arr['ttg_odds']; //总进球赔率(0球,1球,2球,3球,4球,5球,6球,7+球)
$hafu_odds = $arr['hafu_odds']; //半全场赔率(胜胜,胜平,胜负,平胜,平平,平负,负胜,负平,负负)
$l_cn_a = $arr['l_cn_a']; //联赛简称
$h_cn_a = $arr['h_cn_a']; //主队简称
$a_cn_a = $arr['a_cn_a']; //客队简称
$h_order = $arr['h_order']; //主队排名
$a_order = $arr['a_order']; //客队排名
$l_color = $arr['l_color']; //色标
$weather = $arr['weather']; //天气,城市,温度摄氏度
$match_info = $arr['match_info']; //比赛更新信息
if(strlen($mid)>0){
echo "赛事ID:".$mid."<br>";
echo "场次:".$num."<br>";
echo "比赛时间:".$dtime."<br>";
echo "联赛名称:<font color=$l_color>".$l_cn."</font><br>";
echo "主队名称:".$h_cn."<br>";
echo "客队名称:".$a_cn."<br>";
echo "赛事状态:".$status."<br>";
echo "盘口状态:".$p_status."<br>";
echo "单关1是0否:".$p_single."<br>";
echo "让球数:".$p_goal."<br>";
echo "胜平负赔率:".$had_odds."<br>";
echo "让球胜平负:".$hhad_odds."<br>";
echo "比分胜赔率:".$crs_win."<br>";
echo "比分平赔率:".$crs_draw."<br>";
echo "比分负赔率:".$crs_lose."<br>";
echo "总进球赔率:".$ttg_odds."<br>";
echo "半全场赔率:".$hafu_odds."<br>";
echo "联赛简称:".$l_cn_a."<br>";
echo "主队简称:".$h_cn_a."<br>";
echo "客队简称:".$a_cn_a."<br>";
echo "主队排名:".$h_order."<br>";
echo "客队排名:".$a_order."<br>";
echo "色标:".$l_color."<br>";
echo "天气:".$weather."<br>";
}
}
}else{ echo "请求失败 $result"; };
?>