5andr0 / PogoLocationFeeder

Json feed of pokemon location data
GNU Affero General Public License v3.0
493 stars 170 forks source link

How to extract data with PHP #426

Closed AnibalDuarte closed 7 years ago

AnibalDuarte commented 7 years ago

I wish to get all Pokemon locations on a live map, then how can I get the PogoLocationFeeder info with PHP to insert into my database? Or there is a way to insert the Pokémon info directly on a MySQL Database?

ruchernchong commented 7 years ago

Get XAMPP. Start all the server, then go to localhost/phpmyadmin

Then you should see your database.

You have to start reading up. Grabbing data from database using PHP is the most basic aspect of PHP.

AnibalDuarte commented 7 years ago

I believe that was misunderstood by @ruchern then I'll try to explain it with more details: I want to install PogoLocationFeeder on my server and, with a cronjob or scheduled task, start a PHP script or something similar to capture the PogoLocationFeeder data and insert them into a database. I've tried to do it with the logfile that is generated by software but , besides being far from a good practice, it is a rough adaptation of functionality.

I know that other software ( bots ) do the same, I just like to know how to adapt to PHP and what parameters should I use.

ExcuseMi commented 7 years ago

Start a pogofeeder client and listen to the socket in PHP (or any other languages that can read from TCP sockets). Example: http://stackoverflow.com/questions/12999900/php-socket-listening-loop Listen to the port property in the settings.

You start receiving json objects in the following format. [JsonProperty("ExpirationTimestamp")] public DateTime ExpirationTimestamp { get; set; } [JsonProperty("Latitude")] public double Latitude { get; set; } [JsonProperty("Longitude")] public double Longitude { get; set; } [JsonProperty("Id")] public PokemonId Id { get; set; } = PokemonId.Missingno; [JsonProperty("IV")] public double IV { get; set; } [JsonProperty("Move1")] public PokemonMove Move1 { get; set; } [JsonProperty("Move2")] public PokemonMove Move2 { get; set; }

Just dump that data into a database. To help you some, here is the pokemonId enum http://pastebin.com/CnEkGEmh and the PokemonMove enum http://pastebin.com/JtgyhpS9

Please send us a link if you get it working.

AnibalDuarte commented 7 years ago

TYVM @ExcuseMi , just now I realyze how stupid was my question :/