Page 1 of 1

JSONAPI is driving me insane...

Posted: Wed Oct 16, 2013 4:53 am
by killfrog47
Hello all! Its been awhile =( But im back! And I have a question!

I am using JSONAPI to get my users permission group, if it would work. When I run the php script nothing happens. I contacted both my web host and MC server host and both say that the port I use is open.

Here is my log: http://pastebin.com/X6CtmG9g

and now my PHP code:

[syntax=php]
<?php
include('JSONAPI.php');
if(!empty($_SESSION['user'])){
$obj = new JSONAPI('198.8.95.3', 20059, 'myuname', 'mypass', 'mysaltnum');
$group = $obj->permissions.getGroups("{$_SESSION['user']['username']}");
echo $group;
}else{
echo "Not logged in!";
}
//I also tried the following code:

if(!empty($_SESSION['user'])){
$obj = new JSONAPI('198.8.95.3', 20059, 'myuname', 'mypass', 'mysaltnum');
$group = $obj->permissions.getGroups("killfrog47");
echo $group;
}else{
echo "Not logged in!";
}
?>
[/syntax]

I have contacted the developer but he doesnt seem to care lol. Any ideas? Help of any kind would be GREAT! Maybe another idea on a plugin I can use?

Re: JSONAPI is driving me insane...

Posted: Wed Oct 16, 2013 6:08 am
by ScTech
From a glance it looks like you forgot session_start();

EDIT: One more edit ;) If session_start(); is not your issue, the API docs shows that it returns "string[]". I assume they mean an array by the brackets? You can try using var_dump() or print_r().

Re: JSONAPI is driving me insane...

Posted: Wed Oct 16, 2013 9:08 am
by Temor
I'm on my phone at Hongkong airport so I'm not looking too closely on the code, but does it work locally?

Re: JSONAPI is driving me insane...

Posted: Thu Oct 17, 2013 12:40 am
by killfrog47
ScTech wrote:From a glance it looks like you forgot session_start();

EDIT: One more edit ;) If session_start(); is not your issue, the API docs shows that it returns "string[]". I assume they mean an array by the brackets? You can try using var_dump() or print_r().

I have the session starting up in the top of the page. I tried var_dump() and im now getting NULL so that is a step in the right direction =) lol

Temor wrote:I'm on my phone at Hongkong airport so I'm not looking too closely on the code, but does it work locally?

Ooooh hows Hong Kong? And no it does not work locally. I am going to test it again on my web server see if I missed anything.

Re: JSONAPI is driving me insane...

Posted: Thu Oct 17, 2013 2:25 am
by ScTech
There have been issues reported to their bukkit page on this. One person seems to have a solution however.

" Alec changed the API but forgot to edit the librairies, so just put use-new-api to false in the configuration of the plugin."

Re: JSONAPI is driving me insane...

Posted: Thu Oct 17, 2013 7:32 am
by killfrog47
ScTech wrote:There have been issues reported to their bukkit page on this. One person seems to have a solution however.

" Alec changed the API but forgot to edit the libraries, so just put use-new-api to false in the configuration of the plugin."


As this would make sense it is still not working =/ I think the problem is that the developer doesnt have any examples haha I cant seem to find any WORKING code on the internet lol. Maybe ill make a post on the bukkit forums asking for any examples lol. Thanks for the help! I wish the developer would respond to me lol

EDIT:
Its working now! I fixed it =) the "use-new-api: worked" =)