testtongji.php 程式碼如下
$url = 'https://www.zzxxxx.xx/api / wetds/stats/';
$options = array(
'http' => array(
'header' =>; 「內容類型:application/json”,
'header' => “授權:令牌633b4deb1cd517a01851a3335811b9ae8e1d6d6d”,
# # # # ' => http_build_query ));$context = stream_context_create($options);#$result = file_get_contents($ url, false, $$result = file_get_contents($ url, false, $$result = file_get_contents($ url, false, $$result = file_get_contents($ url, false, $# context);echo ($result);# 開啟testtongji.php 回傳資料如下{"bandwidth_used":393073846353,"bandwidth_remaining":680667977647.0,"bandwidth_limit":1073741824000.0,"bandwidth_limit":1073741824000.0,"bandwidth_projected:10496" T01:59:38 .381732-08:00 "," requests_total":239278,"requests_successful":238115,"requests_failed":1163,"request_countries":{"US":238334,"NL":848,"RS"96},"RS" target_read_deadline":1142,"target_connect_timeout":12,"client_read_timeout":2,"client_read_eof":7},"request_failure_status_codes":{}}##echo##resultus_codes;
需要把以上回傳的資料整理為以下 bandwidth_used":393073846353,"bandwidth_remaining":680667977647.0 計算出39307384635 GB 像下面這樣出展示,其他的數據都不要
已使用流量: XXXX GB
剩餘流量: XXXX GB
######