NicklasWallgren / PokemonGoAPI-PHP

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

Incorrect wire format #85

Closed br0kenb1nary closed 8 years ago

br0kenb1nary commented 8 years ago

Not sure why but I keep receiving the following fatal error

Fatal error: Uncaught exception 'Exception' with message 'Incorrect wire format for field 7, expected: 2 got: 4' in the ResponseEnvelope.php file

I have tried changing PHP versions from 5.6 to 7 and I have the BCMath and GMP libraries installed.

Any ideas?

Cheers

Ni42 commented 8 years ago

Which version are you using? Which code are you running?

br0kenb1nary commented 8 years ago

I am using the latest commit and testing using RetrievePlayerProfile.php with correct credentials.

NicklasWallgren commented 8 years ago

@damiendarko What type of account is it, PTC or Google? Have you used the account in-game since earlier?

br0kenb1nary commented 8 years ago

Google. Yes I have used the account both before and after. I even tried logging out of the account and waiting an hour before trying the script to avoid any "suspicious" login activity issues with Google.

NicklasWallgren commented 8 years ago

Have you updated the dependencies?

What do get if you run the following snippet: var_dump(PHP_INT_SIZE);

br0kenb1nary commented 8 years ago

I have updated all dependencies. I get int(8) on the dump.

WisdomSky commented 8 years ago

I'm experiencing the same problem too.

NicklasWallgren commented 8 years ago

Can you replicate the issue in the latest release?

br0kenb1nary commented 8 years ago

Same issue exists.

Logging in with the incorrect details does show an error so I know the wire format error comes post login as it only show with the correct credentials.

Additionally (not sure if is of any use) but PHP throws a 500 error unless error_reporting(E_ALL); ini_set('display_errors', 'on'); is added a the top of the script.

Even with the error script removed, although a 500 error is thrown, there is nothing in the apache log related to the script.

NicklasWallgren commented 8 years ago

@damiendarko Have you tried to login using auth code, refresh token?

WisdomSky commented 8 years ago

@NicklasWallgren

Issue still persists after pulling the latest commit:

Fatal error: Uncaught Exception: Incorrect wire format for field 7, expected: 2 got: 4 in /var/www/html/scrup/public/pogo/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Networking/Envelopes/ResponseEnvelope.php:80 Stack trace: #0 /var/www/html/scrup/public/pogo/src/Handlers/RequestHandler.php(255): POGOProtos\Networking\Envelopes\ResponseEnvelope->read(Resource id #23) #1 /var/www/html/scrup/public/pogo/src/Handlers/RequestHandler.php(240): NicklasW\PkmGoApi\Handlers\RequestHandler->unmarshall(Object(GuzzleHttp\Psr7\Response)) #2 /var/www/html/scrup/public/pogo/src/Handlers/RequestHandler.php(116): NicklasW\PkmGoApi\Handlers\RequestHandler->call(Object(POGOProtos\Networking\Envelopes\RequestEnvelope)) #3 /var/www/html/scrup/public/pogo/src/Services/Request/PlayerRequestService.php(20): NicklasW\PkmGoApi\Handlers\RequestHandler->handle(Object(NicklasW\PkmGoApi\Requests\GetPlayerRequest)) #4 /var/www/html/scrup/public/pogo/src/Api/Player/Profile.php(37): NicklasW\PkmGoApi\Services\Request\PlayerRequestService->getPlayer() #5 in /var/www/html/scrup/public/pogo/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Networking/Envelopes/ResponseEnvelope.php on line 80

xdebug: untitled

br0kenb1nary commented 8 years ago

Just a follow up. Enabled HTTP error reporting for Guzzle and it shows a 403 forbidden error on both PTC and Google login

br0kenb1nary commented 8 years ago

Trying method referenced in issue 2265

br0kenb1nary commented 8 years ago

Proxied location. Fixed.

WisdomSky commented 8 years ago

hi @damiendarko can you link the issue? seems issue #2265 doesn't exist

WisdomSky commented 8 years ago

I just want to share some information,

On my part, the reason why I'm experiencing this problem is because I'm using Digital Ocean as my VPS which its IPs are blacklisted. @d3vilsn0w mentioned this in #76.

The workaround would be to use Proxy instead. You can refer to #83 on how to set proxy.