JSONAPI is driving me insane...

Ask about a PHP problem here.
Post Reply
User avatar
killfrog47
Posts: 106
Joined: Tue Mar 12, 2013 2:52 am
Location: Tempe, AZ
Contact:

JSONAPI is driving me insane...

Post 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?
ScTech
Posts: 92
Joined: Sat Aug 24, 2013 8:40 pm

Re: JSONAPI is driving me insane...

Post 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().
Last edited by ScTech on Wed Oct 16, 2013 5:00 pm, edited 3 times in total.
<?php while(!$succeed = try()); ?>
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: JSONAPI is driving me insane...

Post 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?
User avatar
killfrog47
Posts: 106
Joined: Tue Mar 12, 2013 2:52 am
Location: Tempe, AZ
Contact:

Re: JSONAPI is driving me insane...

Post 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.
ScTech
Posts: 92
Joined: Sat Aug 24, 2013 8:40 pm

Re: JSONAPI is driving me insane...

Post 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."
<?php while(!$succeed = try()); ?>
User avatar
killfrog47
Posts: 106
Joined: Tue Mar 12, 2013 2:52 am
Location: Tempe, AZ
Contact:

Re: JSONAPI is driving me insane...

Post 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" =)
Post Reply