-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
74 lines (63 loc) · 2.18 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
// 有cookie true 无cooie false
function https_request($url, $post=true , $data = null , $cookie_file)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
// curl_setopt($curl, CURLOPT_COOKIE, 'SERVERID=9da578c0b665d0cc9f7c94ba4695a61e|1518427407|1518427335;bh3_2018spring=3XlRDbx0zNyYTM5EDO2UQO%3D%3D;sign_event=0086097e73fd84a8cac04ac1111ec8da2e0e58a52ca0b4dd0a93bf503a6e6402;');
if($post){
if (!empty($data)) { //数组不为空的时候传参
curl_setopt($curl, CURLOPT_POST, 1); //POST 开启
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); //POST传参数
}
}
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
function dump($res){
echo "<pre>";
var_dump($res);
echo "</pre>";
}
function bangzhu($tel){
include_once('./mysql.php');
$link = new Mysql();
$sql = "select tel,auth,nickname from member";
$res = $link->query($sql);
// dump($res);
$chenggong = '';
$yijing = '';
$shangxian = '';
$cookie_file = "./cookies/".$tel.".txt";
$url = "https://event.bh3.com/bh3_2018spring_festival/friends.php";
foreach($res as $k=>$v){
// dump($v[0]);
$data = [
'auth'=>$v[1],
'sign'=>''
];
$response = https_request($url,true,$data,$cookie_file);
$response = json_decode($response);
if($response->retcode == 0){
$chenggong =$chenggong.$v[2].":".$response->msg.",礼物:".$response->data."<br>\r\n";
}elseif($response->retcode == 1) {
$yijing = $yijing.$v[2].":".$response->msg."<br>\r\n";
}elseif($response->retcode == 2){
$shangxian = $shangxian.$v[2].":".$response->msg."<br>\r\n";
}
}
// echo $chenggong;
// echo "<hr>";
// echo $yijing;
// echo "<hr>";
// echo $shangxian;
$log = $chenggong."\r\n<hr>\r\n".$yijing."\r\n<hr>\r\n".$shangxian;
return $log;
}
?>