$ipmodel[1],
+ 'city' => $city[1],
+ ];
+
+ // print_r($data);
+
+ echo json_encode($data);
+ }
+
+ public function setAddress()
+ {
+
+ $data = json_decode(file_get_contents("php://input"),true);
+
+ $login_url = 'http://106.52.152.33:8899/main/raduserLogin';
+
+ $params = array(
+ "username" => $data['account'],
+ "password" => $data['password'],
+ );
+
+ $login_content = linkcurl($login_url,'POST',$params);
+
+ preg_match_all('/set\-cookie:([^\r\n]*); path/i', $login_content, $m);
+
+ $cookie = $m[1][0];
+
+ $url = 'http://106.52.152.33:8899/panel/index';
+ $params = array(
+ "act" => 'save',
+ "username" => $data['account'],
+ "ipmode" => $data['ipmode'],
+ "citys[]" => implode(',',$data['list']),
+ );
+ $header = array();
+ $header[] = "Cookie:".$cookie;
+ $data = linkcurl($url,'POST',$params,$header);
+
+ if (strpos($data, '提交成功') !== false) {
+ echo json_encode(['code'=>1]);
+ }
+ }
}
diff --git a/fastphp/func/common.php b/fastphp/func/common.php
index ea4d23b..a2a7490 100644
--- a/fastphp/func/common.php
+++ b/fastphp/func/common.php
@@ -148,7 +148,7 @@ function realname($data){
* @param int $ipost [是否采用POST形式]
* @return string
*/
-function linkcurl($url,$method,$params=false,$header=[]){
+function linkcurl($url,$method,$params=[],$header=[]){
$httpInfo = array();
$ch = curl_init();
@@ -157,6 +157,7 @@ function linkcurl($url,$method,$params=false,$header=[]){
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_HEADER, 1); //是否显示头信息
if (1 == strpos("$".$url, "https://"))
{
@@ -169,7 +170,7 @@ function linkcurl($url,$method,$params=false,$header=[]){
if($method == "POST" ){
curl_setopt( $ch , CURLOPT_POST , true );
- curl_setopt( $ch , CURLOPT_POSTFIELDS, json_encode($params) );
+ curl_setopt( $ch , CURLOPT_POSTFIELDS, $params );
}else if($params){
curl_setopt( $ch , CURLOPT_URL , $url.'?'.http_build_query($params) );
}
diff --git a/script/linedata/auto_format.php b/script/linedata/auto_format.php
index 3a4a6bd..7820e55 100644
--- a/script/linedata/auto_format.php
+++ b/script/linedata/auto_format.php
@@ -1,7 +1,7 @@
$val) {
+ foreach ($val as $net_data) {
+
+ fputcsv($file1, $net_data);
+ }
+ }
+ fclose($file1);
+ fclose($file);
+}
+
function format_product($file_path, $dns = '')
{
$list1 = [];
diff --git a/script/linedata/display.php b/script/linedata/display.php
index 91a0ba7..268b238 100755
--- a/script/linedata/display.php
+++ b/script/linedata/display.php
@@ -55,6 +55,9 @@ switch ($id) {
case 18:
get_product(__DIR__ . '/data/download/mogu.csv');
break;
+ case 19:
+ get_product(__DIR__ . '/data/download/huohu.csv');
+ break;
}
function get_all_product($file_path)
diff --git a/script/linedata/get_line_list.php b/script/linedata/get_line_list.php
index 9f6a001..1daf3ea 100755
--- a/script/linedata/get_line_list.php
+++ b/script/linedata/get_line_list.php
@@ -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("//is", $content, $result);
+// //获取城市数据
+// // preg_match_all("/(.*?)/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("//is", $content, $result);
+//获取城市数据
+// preg_match_all("/| (.*?)/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>/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')]);
| |