服务器列表2
This commit is contained in:
101
script/linedata/display.php
Normal file
101
script/linedata/display.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @Descripttion:
|
||||||
|
* @version:
|
||||||
|
* @Author: kangkang
|
||||||
|
* @Date: 2020-11-06 14:32:57
|
||||||
|
* @LastEditors: kangkang
|
||||||
|
* @LastEditTime: 2020-11-06 15:24:49
|
||||||
|
*/
|
||||||
|
$id = $_GET['product'];
|
||||||
|
switch($id){
|
||||||
|
case 0:
|
||||||
|
format_product('./all.csv');
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
format_xingxing('./xingxing.csv','2288.csv');
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
format_product('./xianfeng.csv');
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
format_product('./jike.csv');
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
format_product('./qiangzi.csv');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
format_product('./xunlian.csv');
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
format_product('./tiantian.csv');
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
format_product('./laoying.csv');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
format_product('./jinrui.csv');
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
format_product('./wuxian.csv');
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
format_product('./shihui.csv');
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
format_product('./gongxiang.csv');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
function format_product($file_path){
|
||||||
|
$list = [];
|
||||||
|
$file = fopen($file_path,'r');
|
||||||
|
while ($info = fgetcsv($file)) {
|
||||||
|
$data['city'] = $info[0];
|
||||||
|
$data['supply'] = $info[1];
|
||||||
|
$data['ip'] = $info[2];
|
||||||
|
$data['daikuan'] = $info[3];
|
||||||
|
$data['onlineuser'] = $info[4];
|
||||||
|
$data['maxuser'] = $info[5];
|
||||||
|
$data['online'] = $info[6];
|
||||||
|
$data['status'] = $info[7];
|
||||||
|
$data['nasname'] = $info[8];
|
||||||
|
$list[] = $data;
|
||||||
|
}
|
||||||
|
fclose($file);
|
||||||
|
echo json_encode(['data'=>$list]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function format_xingxing($file_path1,$file_path2){
|
||||||
|
$list1 = [];
|
||||||
|
$file1 = fopen($file_path1,'r');
|
||||||
|
$file2 = fopen($file_path2,'r');
|
||||||
|
while ($info = fgetcsv($file1)) {
|
||||||
|
$data['city'] = $info[0];
|
||||||
|
$data['supply'] = $info[1];
|
||||||
|
$data['ip'] = $info[2];
|
||||||
|
$data['daikuan'] = $info[3];
|
||||||
|
$data['onlineuser'] = $info[4];
|
||||||
|
$data['maxuser'] = $info[5];
|
||||||
|
$data['online'] = $info[6];
|
||||||
|
$data['status'] = $info[7];
|
||||||
|
$data['nasname'] = $info[8];
|
||||||
|
$list1[] = $data;
|
||||||
|
}
|
||||||
|
while ($info = fgetcsv($file2)) {
|
||||||
|
$data['city'] = $info[0];
|
||||||
|
$data['supply'] = $info[1];
|
||||||
|
$data['ip'] = $info[2];
|
||||||
|
$data['daikuan'] = $info[3];
|
||||||
|
$data['onlineuser'] = $info[4];
|
||||||
|
$data['maxuser'] = $info[5];
|
||||||
|
$data['online'] = $info[6];
|
||||||
|
$data['status'] = $info[7];
|
||||||
|
$data['nasname'] = $info[8];
|
||||||
|
$list2[] = $data;
|
||||||
|
}
|
||||||
|
fclose($file1);
|
||||||
|
fclose($file2);
|
||||||
|
$list = array_merge($list1,$list2);
|
||||||
|
echo json_encode(['data'=>$list]);
|
||||||
|
}
|
||||||
@@ -5,60 +5,68 @@
|
|||||||
* @Author: kangkang
|
* @Author: kangkang
|
||||||
* @Date: 2020-11-03 11:04:15
|
* @Date: 2020-11-03 11:04:15
|
||||||
* @LastEditors: kangkang
|
* @LastEditors: kangkang
|
||||||
* @LastEditTime: 2020-11-06 14:22:26
|
* @LastEditTime: 2020-11-06 16:47:03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
header('Access-Control-Allow-Origin: *');
|
|
||||||
header("Access-Control-Allow-Methods: *");
|
|
||||||
header('Access-Control-Allow-Headers:*');
|
|
||||||
header("Access-Control-Allow-Credentials: true");
|
|
||||||
|
|
||||||
$all = fopen('./all.csv','w');
|
$all = fopen('./all.csv','w');
|
||||||
|
$dnx_exit = fopen('./dns_diff.csv','a');
|
||||||
|
$dnx_has_exit = get_product('./dns_diff.csv',1);
|
||||||
|
|
||||||
|
$qiangzi_data = get_product('./qiangzi.csv');
|
||||||
$qiangzi_f = fopen('./qiangzi.csv','w');
|
$qiangzi_f = fopen('./qiangzi.csv','w');
|
||||||
$qiangzi = json_decode(file_get_contents("http://47.92.116.14:2222/api/areaPool.html?type=json"), true);
|
$qiangzi = json_decode(file_get_contents("http://47.92.116.14:2222/api/areaPool.html?type=json"), true);
|
||||||
//写入强子文件
|
//写入强子文件
|
||||||
qiangzi_getList($qiangzi,$qiangzi_f,$all);
|
qiangzi_getList($qiangzi,$qiangzi_f,$all,$qiangzi_data);
|
||||||
fclose($qiangzi_f);
|
fclose($qiangzi_f);
|
||||||
|
|
||||||
|
$xingxing_data = get_product('./xingxing.csv');
|
||||||
$xingxing_f = fopen('./xingxing.csv','w');
|
$xingxing_f = fopen('./xingxing.csv','w');
|
||||||
$xingxing = json_decode(file_get_contents("http://47.110.154.124:6930/api/nasStatus.html?format=json"), true);
|
$xingxing = json_decode(file_get_contents("http://47.110.154.124:6930/api/nasStatus.html?format=json"), true);
|
||||||
//写入星星文件
|
//写入星星文件
|
||||||
xingxing_getList($xingxing,$xingxing_f,$all);
|
xingxing_getList($xingxing,$xingxing_f,$all,$xingxing_data);
|
||||||
fclose($xingxing_f);
|
fclose($xingxing_f);
|
||||||
|
|
||||||
|
$jike_data = get_product('./jike.csv');
|
||||||
$jike_f = fopen('./jike.csv','w');
|
$jike_f = fopen('./jike.csv','w');
|
||||||
$jike = json_decode(file_get_contents("http://api.webok.me/beikeiplist/"), true)['data'];
|
$jike = json_decode(file_get_contents("http://api.webok.me/beikeiplist/"), true)['data'];
|
||||||
//写入极客文件
|
//写入极客文件
|
||||||
jike_getList($jike,$jike_f,$all);
|
jike_getList($jike,$jike_f,$all,$jike_data);
|
||||||
fclose($jike_f);
|
fclose($jike_f);
|
||||||
|
|
||||||
|
$tiantian_data = get_product('./tiantian.csv');
|
||||||
$tiantian_f = fopen('./tiantian.csv','w');
|
$tiantian_f = fopen('./tiantian.csv','w');
|
||||||
$tiantian = json_decode(file_get_contents("http://api.ipzuiduo.com/api/areas?apiid=135&sendtime=".time()."&sign=".md5('apiid=135&sendtime='.time().'Fz1JRXVBCuwja2G2SoY2EUdgXtCGSBXS')), true)['data'];
|
$tiantian = json_decode(file_get_contents("http://api.ipzuiduo.com/api/areas?apiid=135&sendtime=".time()."&sign=".md5('apiid=135&sendtime='.time().'Fz1JRXVBCuwja2G2SoY2EUdgXtCGSBXS')), true)['data'];
|
||||||
//写入天天文件
|
//写入天天文件
|
||||||
tiantian_getList($tiantian,$tiantian_f,$all);
|
tiantian_getList($tiantian,$tiantian_f,$all,$tiantian_data,'天天');
|
||||||
fclose($tiantian_f);
|
fclose($tiantian_f);
|
||||||
|
|
||||||
|
$laoying_data = get_product('./laoying.csv');
|
||||||
$laoying_f = fopen('./laoying.csv','w');
|
$laoying_f = fopen('./laoying.csv','w');
|
||||||
$laoying = json_decode(get_content('https://dl.ipduoduo.com/api/area?_=1604541004026','_dailissid=b3da7e1676537db8a36b7e4778bfed50c4f388237dc4e71d2e09386fe927a8927cd506150a323beda7f3a8330fa7665d31e3a712b14513c61529290a'), true)['data'];
|
$laoying = json_decode(get_content('https://dl.ipduoduo.com/api/area?_=1604541004026','_dailissid=b3da7e1676537db8a36b7e4778bfed50c4f388237dc4e71d2e09386fe927a8927cd506150a323beda7f3a8330fa7665d31e3a712b14513c61529290a'), true)['data'];
|
||||||
//写入老鹰文件
|
//写入老鹰文件
|
||||||
tiantian_getList($laoying,$laoying_f,$all);
|
tiantian_getList($laoying,$laoying_f,$all,$laoying_data,'老鹰');
|
||||||
fclose($laoying_f);
|
fclose($laoying_f);
|
||||||
|
|
||||||
|
$shihui_data = get_product('./shihui.csv');
|
||||||
$shihui_f = fopen('./shihui.csv','w');
|
$shihui_f = fopen('./shihui.csv','w');
|
||||||
$shihui = get_content('http://39.96.182.192:8888/agent.html','PHPSESSID=4215spk7em5u4kutgaro65l9f1; menuid=submenu_profile');
|
$shihui = get_content('http://39.96.182.192:8888/agent.html','PHPSESSID=4215spk7em5u4kutgaro65l9f1; menuid=submenu_profile');
|
||||||
//写入实惠文件
|
//写入实惠文件
|
||||||
shihui_getList($shihui,$shihui_f,$all);
|
shihui_getList($shihui,$shihui_f,$all,$shihui_data);
|
||||||
fclose($shihui_f);
|
fclose($shihui_f);
|
||||||
|
|
||||||
|
$gongxiang_data = get_product('./gongxiang.csv');
|
||||||
$gongxiang_f = fopen('./gongxiang.csv','w');
|
$gongxiang_f = fopen('./gongxiang.csv','w');
|
||||||
$gongxiang = get_content('http://118.25.157.170:39999/agent.html','PHPSESSID=hqk8ih6l4hbpp75a7g2sfb3l41');
|
$gongxiang = get_content('http://118.25.157.170:39999/agent.html','PHPSESSID=hqk8ih6l4hbpp75a7g2sfb3l41');
|
||||||
gongxiang_getList($gongxiang,$gongxiang_f,$all);
|
gongxiang_getList($gongxiang,$gongxiang_f,$all,$gongxiang_data);
|
||||||
fclose($gongxiang_f);
|
fclose($gongxiang_f);
|
||||||
|
|
||||||
|
$xunlian_data = get_product('./xunlian.csv');
|
||||||
$xunlian_f = fopen('./xunlian.csv','w');
|
$xunlian_f = fopen('./xunlian.csv','w');
|
||||||
$xunlian = json_decode(file_get_contents("http://xunyou.ippptp.com:2222/api/areaPool.html?type=json"), true);
|
$xunlian = json_decode(file_get_contents("http://xunyou.ippptp.com:2222/api/areaPool.html?type=json"), true);
|
||||||
//写入讯连文件
|
//写入讯连文件
|
||||||
xunlian_getList($xunlian,$xunlian_f,$all);
|
xunlian_getList($xunlian,$xunlian_f,$all,$xunlian_data);
|
||||||
fclose($xunlian_f);
|
fclose($xunlian_f);
|
||||||
|
|
||||||
//星星2288写入all
|
//星星2288写入all
|
||||||
@@ -68,10 +76,12 @@ while ($data = fgetcsv($file2288)) {
|
|||||||
}
|
}
|
||||||
fclose($file2288);
|
fclose($file2288);
|
||||||
fclose($all);
|
fclose($all);
|
||||||
|
fclose($dnx_exit);
|
||||||
|
|
||||||
//强子服务器解析规则
|
//强子服务器解析规则
|
||||||
function qiangzi_getList($data,&$file,&$all)
|
function qiangzi_getList($data,&$file,&$all,$exit)
|
||||||
{
|
{
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
$online = ['故障','正常','异常'];
|
$online = ['故障','正常','异常'];
|
||||||
$status = ['正常','拥挤','超载'];
|
$status = ['正常','拥挤','超载'];
|
||||||
|
|
||||||
@@ -107,6 +117,9 @@ function qiangzi_getList($data,&$file,&$all)
|
|||||||
for ($i=1;$i<6;$i++){
|
for ($i=1;$i<6;$i++){
|
||||||
if(!empty($info['nasname'.$i])){
|
if(!empty($info['nasname'.$i])){
|
||||||
$record['nasname'] = $info['nasname'.$i];
|
$record['nasname'] = $info['nasname'.$i];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,['强子',$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -116,8 +129,9 @@ function qiangzi_getList($data,&$file,&$all)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//星星服务器解析
|
//星星服务器解析
|
||||||
function xingxing_getList($data,&$file,&$all)
|
function xingxing_getList($data,&$file,&$all,$exit)
|
||||||
{
|
{
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
$online = ['离线','在线'];
|
$online = ['离线','在线'];
|
||||||
$province_record = [];
|
$province_record = [];
|
||||||
//省会
|
//省会
|
||||||
@@ -160,6 +174,9 @@ function xingxing_getList($data,&$file,&$all)
|
|||||||
$record['online'] = $online[$info['online']];
|
$record['online'] = $online[$info['online']];
|
||||||
$record['status'] = '';
|
$record['status'] = '';
|
||||||
$record['nasname'] = $info['nasname'];
|
$record['nasname'] = $info['nasname'];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,['星星',$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -167,8 +184,9 @@ function xingxing_getList($data,&$file,&$all)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//极客服务器解析
|
//极客服务器解析
|
||||||
function jike_getList($data,&$file,&$all)
|
function jike_getList($data,&$file,&$all,$exit)
|
||||||
{
|
{
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
$status = ['yes'=>'正常','no'=>'故障'];
|
$status = ['yes'=>'正常','no'=>'故障'];
|
||||||
|
|
||||||
$province_record = [];
|
$province_record = [];
|
||||||
@@ -194,6 +212,9 @@ function jike_getList($data,&$file,&$all)
|
|||||||
$record['online'] = $status[$info['status']];
|
$record['online'] = $status[$info['status']];
|
||||||
$record['status'] = '';
|
$record['status'] = '';
|
||||||
$record['nasname'] = $info['domain'];
|
$record['nasname'] = $info['domain'];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,['极客',$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -201,8 +222,9 @@ function jike_getList($data,&$file,&$all)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//天天服务器解析规则
|
//天天服务器解析规则
|
||||||
function tiantian_getList($data,&$file,&$all)
|
function tiantian_getList($data,&$file,&$all,$exit,$product_name)
|
||||||
{
|
{
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
$status = ['维护中','正常'];
|
$status = ['维护中','正常'];
|
||||||
|
|
||||||
foreach ($data as $info) {
|
foreach ($data as $info) {
|
||||||
@@ -233,6 +255,9 @@ function tiantian_getList($data,&$file,&$all)
|
|||||||
$record['online'] = empty($v['status'])?'维护中':$status[$v['status']];
|
$record['online'] = empty($v['status'])?'维护中':$status[$v['status']];
|
||||||
$record['status'] = '';
|
$record['status'] = '';
|
||||||
$record['nasname'] = $v['address'];
|
$record['nasname'] = $v['address'];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,[$product_name,$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -240,7 +265,8 @@ function tiantian_getList($data,&$file,&$all)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function shihui_getList($html,&$file,&$all){
|
function shihui_getList($html,&$file,&$all,$exit){
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
preg_match("/<p>(.*\s*?)<p> <\/p><\/div>/is", $html, $result);
|
preg_match("/<p>(.*\s*?)<p> <\/p><\/div>/is", $html, $result);
|
||||||
preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result);
|
preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result);
|
||||||
foreach($result[0] as $k=>$info){
|
foreach($result[0] as $k=>$info){
|
||||||
@@ -271,6 +297,9 @@ function shihui_getList($html,&$file,&$all){
|
|||||||
$record['online'] = '';
|
$record['online'] = '';
|
||||||
$record['status'] = '';
|
$record['status'] = '';
|
||||||
$record['nasname'] = $data[count($data)-1];
|
$record['nasname'] = $data[count($data)-1];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,['实惠',$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -282,7 +311,8 @@ function shihui_getList($html,&$file,&$all){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//共享
|
//共享
|
||||||
function gongxiang_getList($html,&$file,&$all){
|
function gongxiang_getList($html,&$file,&$all,$exit){
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
//省会
|
//省会
|
||||||
$province = ['黑龙','内蒙'];
|
$province = ['黑龙','内蒙'];
|
||||||
$province_record = [];
|
$province_record = [];
|
||||||
@@ -414,7 +444,8 @@ function gongxiang_getList($html,&$file,&$all){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function xunlian_getList($data,&$file,&$all){
|
function xunlian_getList($data,&$file,&$all,$exit){
|
||||||
|
global $dnx_exit,$dnx_has_exit;
|
||||||
$online = ['离线','正常'];
|
$online = ['离线','正常'];
|
||||||
$province = ['黑龙','内蒙'];
|
$province = ['黑龙','内蒙'];
|
||||||
$province_record = [];
|
$province_record = [];
|
||||||
@@ -427,8 +458,9 @@ function xunlian_getList($data,&$file,&$all){
|
|||||||
$province_record[] = '混播';
|
$province_record[] = '混播';
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
$record['supply'] = '电信/联通';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$record['supply'] = '电信/联通';
|
||||||
} else {
|
} else {
|
||||||
if(in_array($province_detail,$province)){
|
if(in_array($province_detail,$province)){
|
||||||
$province_detail = mb_substr($info['description'],0,3);
|
$province_detail = mb_substr($info['description'],0,3);
|
||||||
@@ -474,6 +506,9 @@ function xunlian_getList($data,&$file,&$all){
|
|||||||
$record['online'] = $online[$info['online']];
|
$record['online'] = $online[$info['online']];
|
||||||
$record['status'] = '';
|
$record['status'] = '';
|
||||||
$record['nasname'] = $info['nasname'.$i];
|
$record['nasname'] = $info['nasname'.$i];
|
||||||
|
if(!in_array($record['nasname'],$exit) && !in_array($record['nasname'],$dnx_has_exit)){
|
||||||
|
fputcsv($dnx_exit,['讯连',$record['nasname']]);
|
||||||
|
}
|
||||||
fputcsv($file,$record);
|
fputcsv($file,$record);
|
||||||
fputcsv($all,$record);
|
fputcsv($all,$record);
|
||||||
}
|
}
|
||||||
@@ -490,4 +525,15 @@ function get_content($url, $cookie) {
|
|||||||
$rs = curl_exec($ch); //执行cURL抓取页面内容
|
$rs = curl_exec($ch); //执行cURL抓取页面内容
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return $rs;
|
return $rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_product($file_path,$num = 8){
|
||||||
|
$list = [];
|
||||||
|
$file = fopen($file_path,'r');
|
||||||
|
while ($info = fgetcsv($file)) {
|
||||||
|
if(isset($info[$num]))
|
||||||
|
$list[] = $info[$num];
|
||||||
|
}
|
||||||
|
fclose($file);
|
||||||
|
return $list;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user