NicklasWallgren / PokemonGoAPI-PHP

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

Error getProfile #150

Closed andrelicoski closed 7 years ago

andrelicoski commented 7 years ago

hello, after the last update the command does not return anything, they can help?

... $profile = $pokemonGoApi->getProfile()->getData(); exit('username: '.$profile->getUsername());

DrDelay commented 7 years ago

I'm not getting anything either, some first testing showed that there is not a single request (except login) being made to the PoGo-servers in a script only trying to access the profile.

DrDelay commented 7 years ago

There is a request being made, and the response contains the username:

1: 2
2: 780603029
3: "pgorelease.nianticlabs.com/plfe/304"
100 {
  1: 1
  2 {
    1: 1471772867783
    2: "JohnTestaDFirst"
    7: "\000\001\003\004\007"
    8 {
      3: 1
      4: 2
      7: 1
      9: 1
    }
    9: 250
    10: 350
    11: ""
    12: ""
    13: ""
    14 {
      1: "POKECOIN"
    }
    14 {
      1: "STARDUST"
      2: 300
    }
    15: 1
    16 {
      1: 0xf1715125345b3e7f
    }
  }
}

However, the decoding (Reading into PHP class) of it fails, but an exception is not being raised. This is the decoded response:

object(POGOProtos\Networking\Responses\GetPlayerResponse)#78 (4) {
  ["_unknown":"POGOProtos\Networking\Responses\GetPlayerResponse":private]=>
  NULL
  ["success":"POGOProtos\Networking\Responses\GetPlayerResponse":private]=>
  bool(true)
  ["playerData":"POGOProtos\Networking\Responses\GetPlayerResponse":private]=>
  object(POGOProtos\Data\PlayerData)#80 (15) {
    ["_unknown":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["creationTimestampMs":"POGOProtos\Data\PlayerData":private]=>
    int(1471772867783)
    ["username":"POGOProtos\Data\PlayerData":private]=>
    string(0) ""
    ["team":"POGOProtos\Data\PlayerData":private]=>
    int(0)
    ["tutorialState":"POGOProtos\Data\PlayerData":private]=>
    array(0) {
    }
    ["avatar":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["maxPokemonStorage":"POGOProtos\Data\PlayerData":private]=>
    int(0)
    ["maxItemStorage":"POGOProtos\Data\PlayerData":private]=>
    int(0)
    ["dailyBonus":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["equippedBadge":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["contactSettings":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["currencies":"POGOProtos\Data\PlayerData":private]=>
    array(0) {
    }
    ["remainingCodenameClaims":"POGOProtos\Data\PlayerData":private]=>
    int(0)
    ["buddyPokemon":"POGOProtos\Data\PlayerData":private]=>
    NULL
    ["_unknown":"ProtobufMessage":private]=>
    NULL
  }
  ["_unknown":"ProtobufMessage":private]=>
  NULL
}

Everything but the creationTimestampMs gets silently discarded somehow.

DrDelay commented 7 years ago

Decoding using jaspervdm/pogoprotos-php/GetPlayerResponse.php works:

object(POGOProtos\Networking\Responses\GetPlayerResponse)#5 (4) {
  ["unknownFieldSet":protected]=>
  NULL
  ["extensions":protected]=>
  NULL
  ["success":protected]=>
  bool(true)
  ["player_data":protected]=>
  object(POGOProtos\Data\PlayerData)#10 (15) {
    ["unknownFieldSet":protected]=>
    NULL
    ["extensions":protected]=>
    NULL
    ["creation_timestamp_ms":protected]=>
    int(1471772867783)
    ["username":protected]=>
    string(15) "JohnTestaDFirst"
    ["team":protected]=>
    NULL
    ["tutorial_state":protected]=>
    object(Protobuf\EnumCollection)#11 (1) {
      ["storage":"ArrayObject":private]=>
      array(5) {
        [0]=>
        object(POGOProtos\Enums\TutorialState)#12 (2) {
          ["value":protected]=>
          int(0)
          ["name":protected]=>
          string(12) "LEGAL_SCREEN"
        }
        [1]=>
        object(POGOProtos\Enums\TutorialState)#13 (2) {
          ["value":protected]=>
          int(1)
          ["name":protected]=>
          string(16) "AVATAR_SELECTION"
        }
        [2]=>
        object(POGOProtos\Enums\TutorialState)#14 (2) {
          ["value":protected]=>
          int(3)
          ["name":protected]=>
          string(15) "POKEMON_CAPTURE"
        }
        [3]=>
        object(POGOProtos\Enums\TutorialState)#15 (2) {
          ["value":protected]=>
          int(4)
          ["name":protected]=>
          string(14) "NAME_SELECTION"
        }
        [4]=>
        object(POGOProtos\Enums\TutorialState)#16 (2) {
          ["value":protected]=>
          int(7)
          ["name":protected]=>
          string(30) "FIRST_TIME_EXPERIENCE_COMPLETE"
        }
      }
    }
    ["avatar":protected]=>
    object(POGOProtos\Data\Player\PlayerAvatar)#17 (11) {
      ["unknownFieldSet":protected]=>
      NULL
      ["extensions":protected]=>
      NULL
      ["skin":protected]=>
      NULL
      ["hair":protected]=>
      int(1)
      ["shirt":protected]=>
      int(2)
      ["pants":protected]=>
      NULL
      ["hat":protected]=>
      NULL
      ["shoes":protected]=>
      int(1)
      ["gender":protected]=>
      NULL
      ["eyes":protected]=>
      int(1)
      ["backpack":protected]=>
      NULL
    }
    ["max_pokemon_storage":protected]=>
    int(250)
    ["max_item_storage":protected]=>
    int(350)
    ["daily_bonus":protected]=>
    object(POGOProtos\Data\Player\DailyBonus)#18 (4) {
      ["unknownFieldSet":protected]=>
      NULL
      ["extensions":protected]=>
      NULL
      ["next_collected_timestamp_ms":protected]=>
      NULL
      ["next_defender_bonus_collect_timestamp_ms":protected]=>
      NULL
    }
    ["equipped_badge":protected]=>
    object(POGOProtos\Data\Player\EquippedBadge)#19 (5) {
      ["unknownFieldSet":protected]=>
      NULL
      ["extensions":protected]=>
      NULL
      ["badge_type":protected]=>
      NULL
      ["level":protected]=>
      NULL
      ["next_equip_change_allowed_timestamp_ms":protected]=>
      NULL
    }
    ["contact_settings":protected]=>
    object(POGOProtos\Data\Player\ContactSettings)#20 (4) {
      ["unknownFieldSet":protected]=>
      NULL
      ["extensions":protected]=>
      NULL
      ["send_marketing_emails":protected]=>
      NULL
      ["send_push_notifications":protected]=>
      NULL
    }
    ["currencies":protected]=>
    object(Protobuf\MessageCollection)#22 (1) {
      ["storage":"ArrayObject":private]=>
      array(2) {
        [0]=>
        object(POGOProtos\Data\Player\Currency)#21 (4) {
          ["unknownFieldSet":protected]=>
          NULL
          ["extensions":protected]=>
          NULL
          ["name":protected]=>
          string(8) "POKECOIN"
          ["amount":protected]=>
          NULL
        }
        [1]=>
        object(POGOProtos\Data\Player\Currency)#23 (4) {
          ["unknownFieldSet":protected]=>
          NULL
          ["extensions":protected]=>
          NULL
          ["name":protected]=>
          string(8) "STARDUST"
          ["amount":protected]=>
          int(300)
        }
      }
    }
    ["remaining_codename_claims":protected]=>
    int(1)
    ["buddy_pokemon":protected]=>
    object(POGOProtos\Data\BuddyPokemon)#24 (5) {
      ["unknownFieldSet":protected]=>
      NULL
      ["extensions":protected]=>
      NULL
      ["id":protected]=>
      int(-1048968017966580097)
      ["start_km_walked":protected]=>
      NULL
      ["last_km_awarded":protected]=>
      NULL
    }
  }
}

The problem must be somewhere in our protos repo.

NicklasWallgren commented 7 years ago

I might have found the cause of the problem ;) Blames @Ni42 :D

https://github.com/NicklasWallgren/pogoprotos-php/commit/7625c43a0b2749f06c427e5b168c2668817671b9

andrelicoski commented 7 years ago

very thanksssss

Ni42 commented 7 years ago

@NicklasWallgren why me, I'm innocent! :)

NicklasWallgren commented 7 years ago

Worth a try... ;)

aaah well, I guess it was me all along :)