Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public function getData(Array $args) {

public function login($username, $password) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/authToken?appId=CPMCAPP&appVersion=1.4&language=en";
$headers = array('Authorization: Basic ' . base64_encode($username . ":" . $password) . "," . $this->api);
$headers = array(
'Authorization: Basic ' . base64_encode($username . ":" . $password) . "," . $this->api,
'User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0');
$data = $this->getData(array("url" => $url, "httpheader" => $headers));
$arrData = json_decode($data, true);
$this->username = $username;
Expand All @@ -60,7 +62,7 @@ public function addCoins($coins) {
"Connection: keep-alive",
"Accept: */*",
"Accept-Language: en-us",
"User-Agent: Club%20Penguin/1.4.12376 CFNetwork/672.1.13 Darwin/14.0.0 Paros/3.2.13",
"User-Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0",
"Authorization: Basic " . $strAuth
);
$data = $this->getData(array("url" => $url, "customrequest" => "PUT", "postfields" => $strCoins, "httpheader" => $headers));
Expand All @@ -73,7 +75,7 @@ public function addCoins($coins) {

public function addItem($item) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=500435792&itemType=paper_item&itemId=" . $item;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array('Authorization: Basic ' . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array('Authorization: Basic ' . base64_encode($this->authToken . ":") . "," . $this->api, 'User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0')));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Successfully added item {$item} to {$this->username}");
Expand All @@ -83,7 +85,7 @@ public function addItem($item) {

public function addIgloo($id) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=400846864&itemType=igloo&itemId=" . $id;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api, "User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0")));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Addded igloo {$id} to {$this->username}");
Expand All @@ -93,7 +95,7 @@ public function addIgloo($id) {

public function addIglooLocation($id) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=400846864&itemType=igloo&itemId=" . $id;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api, "User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0")));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Added igloo location {$id} to {$this->username}");
Expand All @@ -103,7 +105,7 @@ public function addIglooLocation($id) {

public function addFloor($id) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=400846864&itemType=igloo_floor&itemId=" . $id;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api, "User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0")));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Added floor {$id} to {$this->username}");
Expand All @@ -116,7 +118,7 @@ public function addFurniture($id, $amount = 1) {
$url = "https://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=500435792&itemType=furniture_item&itemId=" . $id;
for($i = 0; $i < $amount; $i++) {
$count++;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api, "User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0")));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Added 1 furniture item of ID {$id}. Total: {$count}");
Expand All @@ -127,7 +129,7 @@ public function addFurniture($id, $amount = 1) {

public function addPuffleItem($id) {
$url = "http://api.disney.com/clubpenguin/mobile/v2/purchase?catalogId=500435792&itemType=puffle_item&itemId=" . $id;
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api)));
$data = $this->getData(array("url" => $url, "post" => true, "postfields" => "{}", "httpheader" => array("Authorization: Basic " . base64_encode($this->authToken . ":") . "," . $this->api, "User Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0")));
$arrData = json_decode($data, true);
if(empty($arrData['errorResponse']))
$this->console->fine("Added puffle item {$id} to {$this->username}");
Expand All @@ -144,7 +146,7 @@ public function createPenguin($username, $password, $email, $colour = 4) {
'Connection: keep-alive',
'Accept: */*',
'Accept-Language: en-us',
'User-Agent: Club%20Penguin/1.4.12376 CFNetwork/672.1.13 Darwin/14.0.0 Paros/3.2.13',
'User-Agent: Club%20Penguin/15420 CFNetwork/711.4.6 Darwin/14.0.0',
'Authorization: ' . $this->api
);
$strCreate = utf8_encode('{"password":"' . $password . '","username":"' . $username . '","language":1,"email":"' . $email . '","color":"' . $colour . '","daysAsMember":16}');
Expand All @@ -158,4 +160,4 @@ public function createPenguin($username, $password, $email, $colour = 4) {

}

?>
?>