[PHP] 纯文本查看 复制代码
<?php
error_reporting(0);
header('Content-type: text/json;charset=utf-8');
//预约地址:https://webui.mybti.cn/#/login?clientid=e8725b01-c216-4e29-92a5-f2d1d2343fdc
//authorization 参数
$authorization = $_GET['url'];
//时间点如:0740 - 0750
$time = $_GET['time'];
if(empty($time)){
$time = "0740-0750";
}
//下面是站点配置信息,
$array='{"lineName":"昌平线","snapshotWeekOffset":0,"stationName":"沙河站","enterDate":"'.date("Ymd",strtotime('+1 day')).'","snapshotTimeSlot":"0630-0930","timeSlot":"'.$time.'"}';
if(empty($authorization)){
$authorization = "MzllNWQ4OWUtODY1MS00MjliLTljOTktODhjOTMxOTFlMmQ1LDE2NjE4Mzc3ODU4OTQsUFE2OUp6RXBa6RCtKS2ZsiUXk2N1NiYlpxYUdFPQ==";
}
echo get_curl("https://webapi.mybti.cn/Appointment/CreateAppointment",$array,$authorization);
function get_curl($url,$post=0,$authorization=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0,$randip=0){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "accept: application/json, text/plain, */*";
$httpheader[] = "accept-encoding: gzip, deflate, br";
$httpheader[] = "accept-language: zh-CN,zh;q=0.9";
$httpheader[] = "authorization: $authorization";
$httpheader[] = "content-length: 150";
$httpheader[] = "content-type: application/json;charset=UTF-8";
$httpheader[] = "origin: https://webui.mybti.cn";
$httpheader[] = "referer: https://webui.mybti.cn/";
$httpheader[] = "user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
if($post){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if($header){
curl_setopt($ch, CURLOPT_HEADER, TRUE);
}
if($cookie){
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
if($referer){
curl_setopt($ch, CURLOPT_REFERER, $referer);
}
if($ua){
curl_setopt($ch, CURLOPT_USERAGENT,$ua);
}else{
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36');
}
if($nobaody){
curl_setopt($ch, CURLOPT_NOBODY,1);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
?>