强子爬虫获取列表
This commit is contained in:
45
script/data/get_line_lIst.php
Normal file
45
script/data/get_line_lIst.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @Descripttion:
|
||||||
|
* @version:
|
||||||
|
* @Author: kangkang
|
||||||
|
* @Date: 2020-11-03 11:04:15
|
||||||
|
* @LastEditors: kangkang
|
||||||
|
* @LastEditTime: 2020-11-04 16:06:29
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header("Access-Control-Allow-Methods: *");
|
||||||
|
header('Access-Control-Allow-Headers:*');
|
||||||
|
header("Access-Control-Allow-Credentials: true");
|
||||||
|
|
||||||
|
$qiangzi = file_get_contents("http://47.92.116.14:2222/api/areaPool.html");
|
||||||
|
// var_dump($qiangzi);
|
||||||
|
|
||||||
|
// $file1 = fopen('./product_order.csv','r');
|
||||||
|
preg_match("/<tbody>(.*\s*?)<\/tbody>/is", $qiangzi, $result);
|
||||||
|
|
||||||
|
preg_match_all("/<tr.*?>(.*?)<\/tr>/is", $result[0], $result);
|
||||||
|
|
||||||
|
// echo $result[0][0];
|
||||||
|
// print_r($result[0]);
|
||||||
|
$list = [];
|
||||||
|
foreach ($result[0] as $key => $info) {
|
||||||
|
preg_match_all("/<td.*?>(.*?)<\/td>/is", $info, $data);
|
||||||
|
$get_data = [];
|
||||||
|
$td_info = $data[1];
|
||||||
|
if (isset($td_info[1])) {
|
||||||
|
$daikuan = explode('IP', trim($td_info[2]));
|
||||||
|
$get_data['address'] = trim($td_info[0]);
|
||||||
|
$get_data['yuming'] = trim($td_info[1]);
|
||||||
|
$get_data['ip'] = trim($daikuan[0]) . 'IP';
|
||||||
|
$get_data['daikuan'] = trim($daikuan[1]);
|
||||||
|
preg_match_all("/<span.*?>(.*?)<\/span>/is", trim($td_info[3]), $status);
|
||||||
|
$get_data['status'] = $status[1][0];
|
||||||
|
} else {
|
||||||
|
preg_match_all("/<font.*?>(.*?)<\/font>/is", trim($td_info[0]), $address);
|
||||||
|
$get_data['address'] = $address[1][0];
|
||||||
|
}
|
||||||
|
$list[] = $get_data;
|
||||||
|
}
|
||||||
|
echo json_encode(['data' => $list]);
|
||||||
Reference in New Issue
Block a user