火狐线路

This commit is contained in:
“wanyongkang”
2022-04-14 17:46:56 +08:00
parent d0ed689683
commit 9fa202f23b
2 changed files with 54 additions and 46 deletions

View File

@@ -1,7 +1,7 @@
<?php <?php
function auto_format_list(){ function auto_format_list(){
$product_list = [0, 1, 2, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19]; $product_list = [0, 1, 2, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19,22];
foreach ($product_list as $product) { foreach ($product_list as $product) {
switch ($product) { switch ($product) {
case 0: case 0:
@@ -49,6 +49,9 @@ function auto_format_list(){
case 19: case 19:
format_product_huohu(__DIR__ . '/data/huohu.csv'); format_product_huohu(__DIR__ . '/data/huohu.csv');
break; break;
case 22:
format_product(__DIR__ . '/data/huohu.csv');
break;
} }
} }
} }
@@ -106,7 +109,7 @@ function format_all_product($file_path)
$dns = 'mgip.net'; $dns = 'mgip.net';
break; break;
case '火狐': case '火狐':
$dns = 'hhip'; $dns = 'hhip.vip';
break; break;
default: default:
$dns = 'xlip.vip'; $dns = 'xlip.vip';
@@ -128,8 +131,12 @@ function format_all_product($file_path)
$data['nasname'] = '1.hhip.vip'; $data['nasname'] = '1.hhip.vip';
} else { } else {
$ip = explode('.', ($info[9] ?? '')); $ip = explode('.', ($info[9] ?? ''));
if (count($ip) == 4) {
$data['nasname'] = $info[9];
} else {
$data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0], $dns) . '.' . $dns : ''; $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0], $dns) . '.' . $dns : '';
} }
}
fputcsv($file1, $data); fputcsv($file1, $data);
} }
fclose($file); fclose($file);

View File

@@ -5,20 +5,24 @@
* @Author: kangkang * @Author: kangkang
* @Date: 2020-11-03 11:04:15 * @Date: 2020-11-03 11:04:15
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2022-02-23 18:15:42 * @LastEditTime: 2022-04-14 17:46:14
*/ */
$is_script = 1; $is_script = 1;
include_once __DIR__ . '/../../index.php'; include_once __DIR__ . '/../../index.php';
include_once __DIR__ . '/auto_format.php'; include_once __DIR__ . '/auto_format.php';
// //测试用---------------------------------------------------------------------------------------------------------- // //测试用----------------------------------------------------------------------------------------------------------
// $laoying = json_decode(file_get_contents("http://diqu.pptp.pro:8070/sapi/getroslist"), true)['list'];
// if($laoying){ // $url = 'http://int.linghangadmin.com:8000/sysadmin/useradmin/lineapi_admin1.php?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf';
// $laoying_data = get_product(__DIR__ . '/data/laoying.csv'); // $huohu = json_decode(file_get_contents($url), true);
// $laoying_f = fopen(__DIR__ . '/data/laoying.csv', 'w');
// //写入老鹰文件
// laoying_getList($laoying, $laoying_f, $all, $laoying_data); // if(!empty($huohu)){
// fclose($laoying_f); // $huohu_f = fopen(__DIR__ . '/data/huohu.csv', 'w');
// //写入火狐文件
// $huohu_data = get_product(__DIR__ . '/data/huohu.csv');
// huohu_getList($huohu, $huohu_f, $all,$huohu_data);
// fclose($huohu_f);
// } // }
// die; // die;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -93,23 +97,15 @@ if ($xunlian){
fclose($xunlian_f); fclose($xunlian_f);
} }
$url = 'http://106.52.152.33:8899/panel/index'; $url = 'http://int.linghangadmin.com:8000/sysadmin/useradmin/lineapi_admin1.php?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf';
$header = array(); $huohu = json_decode(file_get_contents($url), true);
$header[] = "Cookie: PHPSESSID=4c0teagu80klg065dk4ho0nvu6";
$content = linkcurl($url,'POST',[],$header);
//获取所有大分类
preg_match_all("/<tr(.*?)<\/tr>/is", $content, $result);
//获取城市数据
// preg_match_all("/<td id=\"pools\">(.*?)<a/is", $result[1][2], $city);
//根据省份获取数据
preg_match_all("/<span class=\"province(.*?)<hr>/is", $result[1][2], $city);
$huohu = $city[1];
if(!empty($huohu)){ if(!empty($huohu)){
$huohu_f = fopen(__DIR__ . '/data/huohu.csv', 'w'); $huohu_f = fopen(__DIR__ . '/data/huohu.csv', 'w');
//写入火狐文件 //写入火狐文件
huohu_getList($huohu, $huohu_f, $all); $huohu_data = get_product(__DIR__ . '/data/huohu.csv');
huohu_getList($huohu, $huohu_f, $all,$huohu_data);
fclose($huohu_f); fclose($huohu_f);
} }
@@ -272,35 +268,40 @@ function qiangzi_getList($data, &$file, &$all, $exit)
} }
//火狐服务器解析规则 //火狐服务器解析规则
function huohu_getList($data, &$file, &$all) function huohu_getList($data, &$file, &$all, $exit)
{ {
global $dnx_exit, $dnx_has_exit;
$online = ['故障', '正常','故障'];
$list = []; $list = [];
$province_record = [];
foreach ($data as $info){ foreach ($data as $info){
$record = []; $record = [];
$record['name'] = '火狐'; $record['name'] = '火狐';
//匹配所有的省份 //如果存在 不为空 则
preg_match("/\'\);\">(.*?)<\/span>/is", $info, $province); if (!in_array( $info['province'], $province_record)) {
$city = $province[1]; $record['city'] = $info['province'];
$record['city'] = $city; $province_record[] = $info['province'];
$key = $record['city']; $key = $record['city'];
$list[$key][] = $record; $list[$key][] = $record;
}
//匹配所有的城市 //匹配所有的城市
preg_match_all("/<\/span><span >(.*?)<\/span><\/span>/is", $info, $citys);
//每一个城市再解析获取城市和剩余数量 //每一个城市再解析获取城市和剩余数量
foreach ($citys[1] as $city_line){
preg_match("/(.*?),剩:/is", $city_line, $address_s);
$address = $address_s[1]; $record['city'] = $info['city'];
$num = explode('>',$city_line)[1]; $record['supply'] = $info['displayname'];
$record['ip'] = '';
$record['city'] = $address; $record['daikuan'] = '';
$record['onlineuser'] = '';
$record['supply'] = $num; $record['maxuser'] = '';
$record['online'] = $online[$info['status']];
$record['online'] = '正常'; $record['nasname'] = $info['ip'];
$record['nasname'] = $address;
$list[$key][] = $record; $list[$key][] = $record;
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
fputcsv($dnx_exit, ['强子', explode('.',$record['nasname'])[0], $record['nasname'], date('Y-m-d H:i:s')]);
} }
} }
foreach ($list as $val) { foreach ($list as $val) {