<?php
$a = file_get_contents("https://3g.dxy.cn/newh5/view/pneumonia");
$b = getSubstr($a,'window.getTimelineService = ','}catch(e){}');//实时热点
$c = getSubstr($a,'window.getAreaStat = ','}catch(e){}');//国内
$d = getSubstr($a,'window.getListByCountryTypeService2 = ','}catch(e){}');//国外
$e = getSubstr($a,'window.getStatisticsService = ','}catch(e){}');//统计
$f = json_decode($e, true);
echo '{"data": ['.'{"result": '.$b.'},'.'{"China": '.$c.'},'.'{"abroad": '.$d.'},'.$e.']}';
function getSubstr($str, $leftStr, $rightStr){
$left = strpos($str, $leftStr);
$right = strpos($str, $rightStr,$left);
if($left < 0 or $right < $left) return '';
return substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr));
}
?>
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询