-
Notifications
You must be signed in to change notification settings - Fork 86
How to use the standard api over http
Alec Gorge edited this page Apr 16, 2011
·
7 revisions
This page assumes you have included the PHP SDK at the top of your PHP file.
Code:
$api = new JSONAPI("localhost", 20059, "username", "password", "salt");
$result = $api->call("getPlayer", array(
"alecgorge"
));
print_r($result);
Result (if the player is on the server):
Array
(
[result] => success
[source] => getPlayer
[success] => Array
(
[inVehicle] =>
[op] => 1
[location] => Array
(
[yaw] => -2.5548048
[pitch] => 4.8013334
[z] => 12
[y] => 68
[x] => -14
)
[inventory] => Array
(
[hand] => Array
(
[amount] => 2
[durability] => 0
[type] => 3
)
[inventory] => Array
(
[0] => Array
(
[amount] => 2
[durability] => 0
[type] => 3
)
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] =>
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
[19] =>
[20] =>
[21] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[27] =>
[28] =>
[29] =>
[30] =>
[31] =>
[32] =>
[33] =>
[34] =>
[35] =>
)
[armor] => Array
(
[helmet] => Array
(
[amount] => 0
[durability] => -1
[type] => 0
)
[boots] => Array
(
[amount] => 0
[durability] => -1
[type] => 0
)
[leggings] => Array
(
[amount] => 0
[durability] => -1
[type] => 0
)
[chestplate] => Array
(
[amount] => 0
[durability] => -1
[type] => 0
)
)
)
[name] => alecgorge
[itemInHand] => Array
(
[amount] => 2
[durability] => 0
[type] => 3
)
[sneaking] =>
[health] => 16
[ip] => /99.73.188.254:50257
)
)
Result (if the player is not on the server):
Array
(
[result] => success
[source] => getPlayer
[success] =>
)
Note how success
is equal to null.