新产品火狐

This commit is contained in:
“wanyongkang”
2021-04-26 18:50:06 +08:00
parent 8efb5f9c5a
commit 33ff11d5ff
5 changed files with 214 additions and 18 deletions

View File

@@ -15,17 +15,30 @@ $product_model = new Product;
$product_list = $product_model->field('Id,Token')->fetchAll();
// // //测试用----------------------------------------------------------------------------------------------------------
// $url = 'http://106.52.152.33:8899/panel/index';
// $header = array();
// $header[] = "Cookie: PHPSESSID=4c0teagu80klg065dk4ho0nvu6";
// $content = linkcurl($url,'POST',[],$header);
// $xianfeng = json_decode(file_get_contents("http://apiserver.pptp.biz/Apiserver/getserver"), true);
// print_r($xianfeng);die;
// if($xianfeng){
// $xianfeng_data = get_product(__DIR__ . '/data/xianfeng.csv');
// $xianfeng_f = fopen(__DIR__ . '/data/xianfeng.csv', 'w');
// //写入先锋文件
// xianfeng_getList($xianfeng, $xianfeng_f, $all, $xianfeng_data);
// fclose($xianfeng_f);
// //获取所有大分类
// 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)){
// $huohu_f = fopen(__DIR__ . '/data/huohu.csv', 'w');
// //写入火狐文件
// huohu_getList($huohu, $huohu_f, $all);
// fclose($huohu_f);
// }
// die;
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//强子迅联特征码
$sp_xl_code = file_get_contents(__DIR__ . '/data/xl.txt', 'r');
@@ -89,6 +102,27 @@ if ($xunlian){
fclose($xunlian_f);
}
$url = 'http://106.52.152.33:8899/panel/index';
$header = array();
$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)){
$huohu_f = fopen(__DIR__ . '/data/huohu.csv', 'w');
//写入火狐文件
huohu_getList($huohu, $huohu_f, $all);
fclose($huohu_f);
}
$time = time();
$noce = md5(time());
$apikey = 'd50f2b2ffd421efa67df8efb96d5ff6c';
@@ -284,6 +318,47 @@ function qiangzi_getList($data, &$file, &$all, $exit)
}
//火狐服务器解析规则
function huohu_getList($data, &$file, &$all)
{
$list = [];
foreach ($data as $info){
$record = [];
$record['name'] = '火狐';
//匹配所有的省份
preg_match("/\'\);\">(.*?)<\/span>/is", $info, $province);
$city = $province[1];
$record['city'] = $city;
$key = $record['city'];
$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];
$num = explode('>',$city_line)[1];
$record['city'] = $address;
$record['supply'] = $num;
$record['online'] = '正常';
$record['nasname'] = $address;
$list[$key][] = $record;
}
}
foreach ($list as $val) {
foreach ($val as $net_data) {
fputcsv($file, $net_data);
fputcsv($all, $net_data);
}
}
}
//星星服务器解析
function xingxing_getList($data, &$file, &$all, $exit)
{
@@ -1005,10 +1080,6 @@ function xianfeng_getList($data, &$file, &$all, $exit)
} else {
$record['status'] = '满载';
}
//南阳
if (strpos($record['city'], '南阳') !== false) {
$record['status'] = '满载';
}
$record['nasname'] = $info['nasname'];
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
fputcsv($dnx_exit, ['先锋', $record['nasname'], date('Y-m-d H:i:s')]);