0

I'm trying to create an extension for the mee6 bot for roleplaying functionality and to make sure everything pairs right on the roleplay server I need to be able the fetch the data and load it into variables I can then runs calculations like skill points, hp, mp, etc off of. But while I can get a plain text database page since its not handled by POST I'm not sure how to read it. (I'm tried $AJAX and $GETJASON and am just not getting any results)

For a reference site here is the page I'm trying to read https://mee6.xyz/levels/267482689529970698?json=1

basically what I need to do is from my own database create users who share the same "name" or idnumber as the meebot, then in my database will be a number of fields like current hp, max, SPECIAL stats (Strength, perception, etc), skills.

The idea being that as mee bot levels the users from using the chat they gain 1 skill point in my system (so 1 level = 1 skill point)

And basically what Ii need to do is compare the local user to Mebot user, matching names/id, and checking the level. If skills < level then there is difference skillpoints left, but when adding a skill in the system i need to check that the new skill will not exceed the level on meebot

Any thoughts. I just need to read meebots data not change it on their end but just not sure how to read non POST data.

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
Lexx Alolia
  • 35
  • 1
  • 7

2 Answers2

0

What you need to do is use json_encode and simple arrays to echo all the results in it. I have done this code but in android via a username, it fetches the data and returns it to me in a stirng in java. In java I then refine the data according to their respective keywords and then convert it into a String , int [] HashTable.

If you need the codes then let me know.

Saim Mahmood
  • 426
  • 2
  • 12
0

A really simple example of using json_decode

//grab the data (you may want to cache this)
$json=file_get_contents('https://mee6.xyz/levels/267482689529970698?json=1');

//decode it..
$data=json_decode($json);
if (is_null($data)) {
    die("Bad JSON data");
}

//extract data you need, e.g.
echo $data->players[0]->avatar;

//iterate over the players...
foreach($data->players as $player) {
    if ($player->name == 'nekollx') {
    }
}
Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
  • thanks, was scratching my head trying to find a way to get the data so i could pare it and i think file get contents was the key, thanks http://www.maskedriders.info/Mee6RP/index.php now i was able to mix the discord user, avatar, and xp systems with my own system now i just need to build the RP system, thanks a ton – Lexx Alolia Jan 30 '17 at 10:58