public function run() { $PokemonGoAPILogin = (new \PokemonGoAPI\Auth\GoogleLogin())->login('*****@*****.**', 'password'); $PokemonGoAPI = new PokemonGoAPI($PokemonGoAPILogin); $PokemonGoAPI->getOutput()->setPKGODEBUG(true); $PokemonGoAPI->getOutput()->write($PokemonGoAPI->getPlayerProfile()->getUsername()); }
/** * BaseExample constructor. */ public function __construct() { $dotenv = new Dotenv\Dotenv(__DIR__); $dotenv->load(); $googleLogin = new \PokemonGoAPI\Auth\GoogleLogin(); $loginData = ($token = @file_get_contents('.token')) ? $googleLogin->loginWithGoogleToken($token) : $googleLogin->login(getenv('EMAIL'), getenv('PASSWORD')); // or by pair email/password file_put_contents('.token', $loginData['Auth']); $this->api = new PokemonGoAPI($loginData); $this->api->getOutput()->setPKGODEBUG(true); }