远程获取JSON接口信息并且解决跨域问题
直接贴上代码
<?php $arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), ); $response = file_get_contents("https://status.figma.com/api/v2/status.json", false, stream_context_create($arrContextOptions)); $json = $response; $arr = (array) json_decode($json,true); if ($arr['status']['description']=='All Systems Operational') { $zt='正常'; } else { $zt='异常'; } echo '当前服务状态:'.$zt; ?>
Devwang版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!