NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

PHP Error #105

Closed b6oy closed 8 years ago

b6oy commented 8 years ago

Hello, I am getting the following error

PHP Fatal error: Uncaught exception 'NicklasW\PkmGoApi\Handlers\RequestHandler\Exception\ResponseException' with message 'Retrieved a invalid response. Response code: '403' in /var/www/html/pokemon/src/Handlers/RequestHandler.php:387\nStack trace:\n#0 /var/www/html/pokemon/src/Handlers/RequestHandler.php(237): NicklasW\PkmGoApi\Handlers\RequestHandler->validateResponse(Object(GuzzleHttp\Psr7\Response))\n#1 /var/www/html/pokemon/src/Handlers/RequestHandler.php(116): NicklasW\PkmGoApi\Handlers\RequestHandler->call(Object(POGOProtos\Networking\Envelopes\RequestEnvelope))\n#2 /var/www/html/pokemon/src/Services/Request/PlayerRequestService.php(20): NicklasW\PkmGoApi\Handlers\RequestHandler->handle(Object(NicklasW\PkmGoApi\Requests\GetPlayerRequest))\n#3 /var/www/html/pokemon/src/Api/Player/Profile.php(37): NicklasW\PkmGoApi\Services\Request\PlayerRequestService->getPlayer()\n#4 /var/www/html/pokemon/src/Api/Player/Profile.php(25): NicklasW\PkmGoApi\Api\Player\Profile->update()\n#5 /var/www/html/pokemon/examples/RetrievePlayerProfileExample.php(35): NicklasW\PkmGo in /var/www/html/pokemon/src/Handlers/RequestHandler.php on line 387

Any idea of what could be wrong here ?

Ni42 commented 8 years ago

HTTP 403 errors mean your IP and/or account is banned. Are you on a cloud hoster?

b6oy commented 8 years ago

no way, I checked the account is fine, dedicated host and I tried multiple accounts. Is there a way to debug this further to get more info? I am trying it on windows now and will post feedback..

Ni42 commented 8 years ago

Sure, the account can be fine, but they have IP blocks in place so you can't login from several VPS providers.

DrDelay commented 8 years ago

You could get more information by inspection the body of the request that fails.

  1. Turn on Guzzles HTTP-error-handling here
  2. Put your code in a try-block
  3. catch (\GuzzleHttp\Exception\RequestException $reqEx)
  4. if ($reqEx->hasResponse()): echo $reqEx->getResponse()->getBody()

Could because sending an error message is not mandatory for them.

b6oy commented 8 years ago

This is very strange, I have windows running on virtualbox same server, works fine. Only on centos I am getting 403, from linux I tried visiting https://pgorelease.********/plfe/ gives forbidden, but from windows works says "Dude, this is the Player Frontend."..