echo PHP_EOL; echo "[INFO] Recieved reply!", PHP_EOL; $in = substr($out, 4); $response = $AMF->destructAMF($in); //var_dump($response); //if(isset($response) && @$response->data['errorMsg'] === "NEED CAPTCHA"){ while (@$response->data['errorMsg'] === "NEED CAPTCHA") { echo "[WARNING] OH SHIT EVONY GAVE YOU A CAPTCHA!" . PHP_EOL; file_put_contents('captcha.png', hex2bin($response->data['captcha'])); unset($in); unset($out); echo "[INFO] Opening captcha.png for manual user solving." . PHP_EOL; exec('captcha.png'); echo "[REQUEST] Please solve the captcha; Just type in the captcha text: "; $captcha = fgets(STDIN); $createplayer = new YaBOB_Common_Createnewplayer(); $player = $createplayer->_($UID, 'Capital', 'BNH', '1', '1', trim(str_replace(PHP_EOL, '', $captcha))); $createplayer = $AMF->AMFlength($player) . $player; $s->write($createplayer); $in = $s->read(); while ($in) { $out = @$out . $in; $in = @$s->read(); } $in = substr($out, 4); $response = $AMF->destructAMF($in); if (!isset($response->data)) { echo "[ERROR] Look's like someone pissed in Evony's Cheerios today; Most likely just 1 hour IP banned by Evony." . PHP_EOL; exit("[EXIT] Unexpected Error"); } }
$s->write($loginData); echo 'Getting response!', PHP_EOL; $in = $s->read(); while ($in) { $out = @$out . $in; $in = @$s->read(); //if (strpos($in, "\n") !== false) break; } echo 'Got response!', PHP_EOL; $out = substr($out, 4); $response = $AMF->destructAMF($out); if (@$response->data['msg'] === "login success") { echo 'server returned: ' . $response->data['msg'] . "\n"; } else { if (@$response->data['errorMsg'] === "need create player") { $createplayer = new YaBOB_Common_Createnewplayer(); $player = $createplayer->_("Packet", '', '', '', ''); $createplayer = $AMF->AMFlength($player) . $player; $s->write($createplayer); $in = $s->read(); //var_dump($in); } else { echo 'server returned: ' . $response->data['errorMsg']; exit; } } //$s->read(); //var_dump($response); function mathRandom() { return (double) rand() / (double) getrandmax();