-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathautoadopter.php
More file actions
79 lines (69 loc) · 2.31 KB
/
autoadopter.php
File metadata and controls
79 lines (69 loc) · 2.31 KB
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
75
76
77
78
79
<?php
set_time_limit(0);
$user = "USERNAME123";
$pass = "123456";
$login = curl_init("http://www.neopets.com/login.phtml");
curl_setopt_array($login, array(
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => "username=".$user."&password=".$pass,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_HEADER => TRUE,
CURLOPT_REFERER => "http://www.neopets.com/",
CURLOPT_RETURNTRANSFER => TRUE,
));
//regex noob
preg_match_all("/Set-Cookie: ([^\n]+)/sim", curl_exec($login), $cookies);
$cookie = "";
foreach($cookies[1] as $coookie){
$cookie.=$coookie.";";
}
curl_close($login);
unset($login);
while(1){
$cache = rand();
$listpets = curl_init();
curl_setopt($listpets, CURLOPT_URL, "http://www.neopets.com/pound/get_adopt.phtml?r=".$cache."");
curl_setopt($listpets, CURLOPT_COOKIE, $cookie);
curl_setopt($listpets, CURLOPT_RETURNTRANSFER, TRUE);
$pets = json_decode(curl_exec($listpets), true);
curl_close($listpets);
unset($listpets);
if(count($pets) > 0){
foreach($pets as $pet){
$sum = $pet['str'] + $pet['def'];
/////////////////////// REQUIREMENTS FOR ADOPTION
if( strtolower($pet['species']) == "lupe" || //Species = lupe
strlen($pet['name']) == "2" || //Name with 2 digits
$sum > "200" || //Strength + defense > 200
(strtolower($pet['species']) == "quiggle" && strtolower($pet['color']) == "island")){ //Island Quiggle
///////////////////////////////////////
adopt($pet['name']);
}
}
}
sleep(1);
}
function adopt($petname){
global $cookie;
$adopt = curl_init("http://www.neopets.com/pound/process_adopt.phtml");
curl_setopt_array($adopt, array(
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => "pet_name=".$petname,
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_COOKIE => $cookie,
CURLOPT_RETURNTRANSFER => TRUE
));
curl_exec($adopt);
curl_close($adopt);
if($adopt !== false) {
echo ($petname." sucessfully adopted");
} else {
echo ("Failed to adopt");
}
unset($adopt);
die();
}
?>