diff --git a/composer.json b/composer.json index 2e4ec41..a017bab 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "This is a library, i think", "keywords": ["api", "php", "GD-API", "geometrydash", "php-library", "geometrydash-api"], "license":"MIT", - "version": "1.0", + "version": "1.1", "autoload": { "psr-4": { "GD-API\\GD-API\\": "autoload.php" diff --git a/src/GDComment.php b/src/GDComment.php index 573a595..95135fd 100644 --- a/src/GDComment.php +++ b/src/GDComment.php @@ -54,10 +54,12 @@ public function __construct ($h, $u, $p, $s = null){ $this->password = $p; $udid = "S" . mt_rand(111111111,999999999) . mt_rand(111111111,999999999) . mt_rand(111111111,999999999) . mt_rand(111111111,999999999) . mt_rand(1,9); $sid = mt_rand(111111111,999999999) . mt_rand(11111111,99999999); + $this->host = str_replace("boomlings", "www.boomlings", $this->host); // <- you have to use www for some reason, thanks rob! $ch = curl_init (); curl_setopt ($ch, CURLOPT_URL, $this->host."/accounts/loginGJAccount.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["secret" => "Wmfv3899gc9", "userName" => $this->username, "password" => $this->password, "udid" => $udid, "sID" => $sid]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["secret" => "Wmfv3899gc9", "userName" => $this->username, "password" => $this->password, "udid" => $udid, "sID" => $sid, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); $info = explode (",", curl_exec ($ch)); $this->usrID = $info[1]; $this->accID = $info[0]; @@ -76,7 +78,8 @@ public function postAccComment ($t, bool $bool = false){ $comment = base64_encode($t); $ch = curl_init ($this->host."/uploadGJAccComment20.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["userName" => $this->username, "gjp" => $this->gjp, "comment" => $comment, "accountID" => $this->accID, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["userName" => $this->username, "gjp" => $this->gjp, "comment" => $comment, "accountID" => $this->accID, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); $res = curl_exec ($ch); if ($res == "-1"){ include __DIR__."/Exception/GDErrors.php"; @@ -105,17 +108,16 @@ public function postComment (string $t, int $l, $bool = false){ //$chk = "UA4BDAQBC1IPVQUMVw0AUAoCWlAAAFFZUwBYBg0JVFoCWwlWC1cPAQ=="; $ch = curl_init ($this->host."/uploadGJComment21.php"); - $headers = array ("X-FORWARDED-FOR: ". $this->getServerIp()); - curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["userName" => $this->username, "gjp" => $this->gjp,"chk" => $chk, "accountID" => $this->accID, "gameVersion" => $gameVersion, "binaryVersion" => $binaryVersion, "comment" => $comment, "levelID" => $levelID, "percent" => $percent, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["userName" => $this->username, "gjp" => $this->gjp,"chk" => $chk, "accountID" => $this->accID, "gameVersion" => "22", "binaryVersion" => "35", "comment" => $comment, "levelID" => $levelID, "percent" => $percent, "secret" => $secret])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); if (curl_exec($ch) == "-1"){ include __DIR__."/Exception/GDErrors.php"; $err = new GDErrors ($this->host); if ($bool = false){ GDErrors::GDPostComment ($levelID); } elseif ($bool = true){ - return curl_exec ($ch)."/". $chk."/". $gameVersion."/". $this->gjp."\/". $comment."/". $secret."/". $this->accID."/". $this->username; + return curl_exec ($ch)."/". $chk."/". "22"."/". $this->gjp."\/". $comment."/". $secret."/". $this->accID."/". $this->username; } } else { return curl_exec ($ch); @@ -132,7 +134,8 @@ public function fetchComment ($i, $m = 0, $c = 0){ $levelID = $i; $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["secret" => $secret, "levelID" => $levelID, "gameVersion" => $gameVersion, "binaryVersion" => $binaryVersion, "mode" => $m, "page" => $c, "count" => 10]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["secret" => $secret, "levelID" => $levelID, "gameVersion" => "22", "binaryVersion" => "35", "mode" => $m, "page" => $c, "count" => 10])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); $arr = explode ("#", curl_exec ($ch))[0]; $arr = explode ("|", $arr); foreach ( $arr as $fetch){ @@ -181,14 +184,14 @@ public function fetchAccComment (){ $page = $this->getPage (); $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, [ - "gameVersion" => $gameVersion, - "binaryVersion" => $binaryVersion, + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query([ + "gameVersion" => '22', + "binaryVersion" => '35', "secret" => $secret, "accountID" => $accounts, "page" => $page, - "total" => 10]); - + "total" => 10])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); $result = curl_exec ($ch); $result = explode ("#", $result)[0]; $result = explode ("|", $result); @@ -214,9 +217,10 @@ public function fetchCommentHistory ($m = 0){ $userID = $this->usrID; $page = $this->getPage (); - $pst = ["gameVersion" => $gameVersion, "binaryVersion" => $binaryVersion, "userID" => $userID, "total" => 10, "secret" => $secret, "mode" => $m, "page" => $page]; + $pst = http_build_query(["gameVersion" => "22", "binaryVersion" => "35", "userID" => $userID, "total" => 10, "secret" => $secret, "mode" => $m, "page" => $page]); $ch = curl_init ($host); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded", "x-forwarded-for: ". $this->getServerIp()]); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $pst); diff --git a/src/GDConfig.php b/src/GDConfig.php index 7129610..7e1a40b 100644 --- a/src/GDConfig.php +++ b/src/GDConfig.php @@ -10,6 +10,7 @@ class GDConfig { public function __construct ($a, $b = null, $c = null){ //Set Host GD $this->host = $a; + $this->host = str_replace("boomlings", "www.boomlings", $this->host); $this->username = $b; $this->password = $c; @@ -19,7 +20,7 @@ public function __construct ($a, $b = null, $c = null){ $sid = mt_rand(111111111,999999999) . mt_rand(11111111,99999999); curl_setopt ($ch, CURLOPT_URL, $this->host."/accounts/loginGJAccount.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["secret" => "Wmfv3899gc9", "userName" => $this->username, "password" => $this->password, "udid" => $udid, "sID" => $sid]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["secret" => "Wmfv3899gc9", "userName" => $this->username, "password" => $this->password, "udid" => $udid, "sID" => $sid, "gameVersion" => '22', "binaryVersion" => '35'])); if (curl_exec($ch) == "-1"){ include __DIR__."/Exception/GDErrors.php"; $err = new GDErrors($this->host); @@ -88,17 +89,19 @@ public function downloadSaveData ($p){ include __DIR__."/../config/config.php"; $url = $this->getAccountURL(); $url = $url."/database/accounts/syncGJAccountNew.php"; - $postfields["gameVersion"] = $gameVersion; - $postfields["binaryVersion"] = 35; $postfields["userName"] = $this->username; $postfields["accountID"] = $this->accountID; $postfields["password"] = $this->password; $postfields["secret"] = "Wmfv3899gc9"; $postfields["gdw"] = 0; + $postfields["gameVersion"] = '22'; + $postfields["binaryVersion"] = '35'; + $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $postfields); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $response = curl_exec ($ch); file_put_contents ($p, explode (";", $response)[0]); return $response; @@ -107,8 +110,8 @@ public function uploadSaveData ($kizunaAI){ include __DIR__."/../config/config.php"; $url = $this->getAccountURL(); $url = $url."/database/accounts/backupGJAccountNew.php"; - $postfields["gameVersion"] = $gameVersion; - $postfields["binaryVersion"] = 35; + $postfields["gameVersion"] = '22'; + $postfields["binaryVersion"] = '35'; $postfields["userName"] = $this->username; $postfields["accountID"] = $this->accountID; $postfields["password"] = $this->password; @@ -118,7 +121,8 @@ public function uploadSaveData ($kizunaAI){ $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $postfields); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $response = curl_exec ($ch); if ($response == "-1" || empty ($response)){ return "Upload Save Data Failed! / ". $response; @@ -130,10 +134,14 @@ private function getAccountURL(){ $postURL["accountID"] = $this->accountID; $postURL["type"] = "2"; $postURL["secret"] = "Wmfd2893gb7"; + $postURL["gameVersion"] = '22'; + $postURL["binaryVersion"] = '35'; + $ch = curl_init ($this->host."/getAccountURL.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $postURL); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($postURL)); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $newHost = curl_exec ($ch); curl_close ($ch); return $newHost; diff --git a/src/GDLevel.php b/src/GDLevel.php index 8b61ed6..c968408 100644 --- a/src/GDLevel.php +++ b/src/GDLevel.php @@ -23,10 +23,12 @@ class GDLevel { public function __construct ($h, $i, $n = null){ include __DIR__."/../config/config.php"; + $h = str_replace("boomlings", "www.boomlings", $h); $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $h."/downloadGJLevel22.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["levelID" => $i, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["levelID" => $i, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $info = explode (":", curl_exec ($ch)); $this->fullString = curl_exec ($ch); diff --git a/src/GDMessage.php b/src/GDMessage.php index 7d9cae7..2e05766 100644 --- a/src/GDMessage.php +++ b/src/GDMessage.php @@ -66,6 +66,7 @@ public function __construct ($h, $u, $p){ include __DIR__."/../config/config.php"; $this->username = $u; $this->host = $h; + $this->host = str_replace("boomlings", "www.boomlings", $this->host); self::$password = $p; $gjp = $this->plaintext (self::$password, 37526); $gp = base64_encode ($gjp); @@ -74,7 +75,8 @@ public function __construct ($h, $u, $p){ $sid = mt_rand(111111111,999999999) . mt_rand(11111111,99999999); $ch = curl_init ($this->host."/accounts/loginGJAccount.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["udid" => $udid, "sID" => $sid,"userName" => $u, "password" => $p, "secret" => "Wmfv3899gc9"]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["udid" => $udid, "sID" => $sid,"userName" => $u, "password" => $p, "secret" => "Wmfv3899gc9", "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $res = curl_exec ($ch); if ($res == "-1"){ include __DIR__."/Exception/GDErrors.php"; @@ -92,18 +94,19 @@ public function getMessage ($pgm = 0){ $url = $this->host."/getGJMessages20.php"; $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["accountID" => $this->accID, "page" => $pgm, "getSent" => 0, "gjp" => self::$gjp, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["accountID" => $this->accID, "page" => $pgm, "getSent" => 0, "gjp" => self::$gjp, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $res = curl_exec ($ch); if ($res == "-1"){ return "Nothing here"; } else { $info = explode ("#", $res)[0]; $info = explode ("|", $info); - foreach ($info as $fetch){ + foreach ($info as $fetch) { $msg = explode (":", $fetch); $arr[] = ["username" => $msg[1], "userID" => $msg[3], "accountID" => $msg[5], "msg" => array("subject" => str_replace ("☆", "", base64_decode ($msg[9])), "messageID" => $msg [7], "sentDate" => $msg[15])]; - } - return $arr; + } + return $res != "-2" ? $arr : []; } } public function readMessage (int $mk){ @@ -111,7 +114,8 @@ public function readMessage (int $mk){ $url = $this->host."/downloadGJMessage20.php"; $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["accountID" => $this->accID, "secret" => $secret, "gjp" => self::$gjp, "messageID" => $mk]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["accountID" => $this->accID, "secret" => $secret, "gjp" => self::$gjp, "messageID" => $mk, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $res = curl_exec ($ch); $info = explode (":", $res); $message = $this->cipher (base64_decode($info[15]), 14251); @@ -121,10 +125,11 @@ public function readMessage (int $mk){ public function deleteMessage (int $o){ include __DIR__."/../config/config.php"; $messageID = $o; - $post = ["accountID" => $this->accID, "gjp" => self::$gjp, "messageID" => $messageID, "secret" => $secret]; + $post = http_build_query(["accountID" => $this->accID, "gjp" => self::$gjp, "messageID" => $messageID, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35']); $ch = curl_init ($this->host."/deleteGJMessages20.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); echo curl_exec ($ch); } public function sendMessage (string $m, string $s, int $t){ @@ -137,7 +142,8 @@ public function sendMessage (string $m, string $s, int $t){ $toAccount = $t; $ch = curl_init ($this->host."/uploadGJMessage20.php"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["toAccountID" => $toAccount, "accountID" => $this->accID, "gjp" => self::$gjp, "body" => $message, "subject" => $subject, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["toAccountID" => $toAccount, "accountID" => $this->accID, "gjp" => self::$gjp, "body" => $message, "subject" => $subject, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); return curl_exec ($ch); } } \ No newline at end of file diff --git a/src/GDProfile.php b/src/GDProfile.php index 9f2902f..ed04686 100644 --- a/src/GDProfile.php +++ b/src/GDProfile.php @@ -27,9 +27,12 @@ public function __construct ($u, $a, $s = null){ include __DIR__."/../config/config.php"; $tar = $a; $host = $u; + $host = str_replace("boomlings", "www.boomlings", $host); // <- you have to use www for some reason, thanks rob! $ch = curl_init ($host."/getGJUserInfo20.php"); + curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, ["targetAccountID" => $tar, "secret" => $secret]); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query(["targetAccountID" => $tar, "secret" => $secret, "gameVersion" => '22', "binaryVersion" => '35'])); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); if ($s == true){ if (curl_exec ($ch) == "1"){ echo "Not Found"; @@ -39,6 +42,7 @@ public function __construct ($u, $a, $s = null){ } $this->fullString = curl_exec ($ch); $info = explode (":", curl_exec ($ch)); + curl_close($ch); $this->userName = $info[1]; $this->usrID = $info[3]; $this->coins = $info[7]; diff --git a/src/GDRegister.php b/src/GDRegister.php index 2326b17..f159f74 100644 --- a/src/GDRegister.php +++ b/src/GDRegister.php @@ -2,6 +2,7 @@ class GDRegister { public function __construct ($h, $u, $p, $e){ include __DIR__."/../config/config.php"; + $h = str_replace("boomlings", "www.boomlings", $h); $url = $h."/accounts/registerGJAccount.php"; $username = $u; @@ -12,10 +13,13 @@ public function __construct ($h, $u, $p, $e){ $post["password"] = $password; $post["email"] = $email; $post["secret"] = "Wmfv3899gc9"; + $post["gameVersion"] = '22'; + $post["binaryVersion"] = '35'; $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + curl_setopt ($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); $res = curl_exec ($ch); } } \ No newline at end of file diff --git a/src/GDSong.php b/src/GDSong.php index 71129c1..2d9f152 100644 --- a/src/GDSong.php +++ b/src/GDSong.php @@ -9,12 +9,16 @@ class GDSong { public function __construct ($i2, $i, $s = null){ include __DIR__."/../config/config.php"; + $i2 = str_replace("boomlings", "www.boomlings", $i2); $host = $i2."/getGJSongInfo.php"; $ch = curl_init ($host); $post["songID"] = $i; $post["secret"] = $secret; + $post["gameVersion"] = '22'; + $post["binaryVersion"] = '35'; curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); + curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["accept: */*", "content-type: application/x-www-form-urlencoded"]); if ($s == true){ if (curl_exec ($ch) == "-1" OR curl_exec ($ch) == ""){ echo "Not Found";