Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by HeyAwesomePeople

  1. Oh yeah... Okay so escaping just the "" doesn't result in an error, I just get the null message again. And the API is pretty simple. https://github.com/alecgorge/jsonapi http://hastebin.com/jozigaruru.php The API provides a way to communicate between a Minecraft server, Java, and the user. This can be through web app or iphone/android app or whatever. I don't think it's the API's fault, as Adminium(IOS app) also has a file manager system using the JSONAPI, and their files work just fine(including the types of one I am messing with). I looked through the Java anyways and found the method I am calling through the website: http://hastebin.com/avodositud.coffee Now this method only returns a success message or an error message, not nothing. It also state here that it should only return true or an error message... I'm also not the best at PHP(still fairly new to it) so the JSONAPI php file is hard to read for me, but I don't see anywhere I could get an error.. I cannot figure this out still. Thanks for helping me so far. What else should I be trying/looking at?
  2. If I don't escape the "" and '' I get php errors.
  3. The script fails because of the "" and '' in the yaml file... see here At least this is what I am assuming, because I can paste any part of the file but I have to escape the quotations. This works but then I have backslashes in my yaml file... Okay scratch what I just said here ^ If I use a literal string, like so, var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", " groups: Owner: default: false permissions: \"\" - \'*\' inheritance: \"\" - Coowner info: prefix: \'&4[Owner]\' build: true suffix: \"\" HeadAdmin: default: false permissions: [ ] inheritance: \"\" - g:server_head_admin - admin info: prefix: \'&c[Head Admin]\' build: true suffix: \"\" Admin: default: false permissions: [ ] inheritance: \"\" - g:bukkit_admin - g:towny_admin - g:groupmanager_admin - g:server_admin - Architect info: prefix: \'&c[Head Admin]\' build: true suffix: \"\" Architect: default: false permissions: [ ] inheritance: \"\" - g:server_architect - HeadModerator info: prefix: \'&a[Architect]\' build: true suffix: \"\" HeadModerator: default: false permissions: [ ] inheritance: \"\" - g:server_head_moderator - Moderator info: prefix: \'&5[Head Moderator]\' build: true suffix: \"\" Moderator: default: false permissions: [ ] inheritance: \"\" - g:bukkit_moderator - g:towny_moderator - g:server_moderator - Helper info: prefix: \'&d[Moderator]\' build: true suffix: \"\" Helper: default: false permissions: [ ] "))); This works fine(Other than the fact it adds backslashes to the yaml). The character count of the string is 1622 characters(this includes spaces). But if I add ANY character, just one more space or letter or number, the code fails and outputs this in its var_dump: null At 1622 characters I get a success message. array (size=1) 0 => array (size=4) 'result' => string 'success' (length=7) 'success' => boolean true 'source' => string 'files.write' (length=11) 'is_success' => boolean true So at first I think there's a limit of 1622 characters, but that's a very specific number. So I put into the literal string 3000 random characters and it worked.... I'm lost here. The difference between working and not working is 1 character...? I did another test too. I cut the yaml file I am editing to around 1550 characters and my script works perfectly fine all the way through. I figured this would be the case, but this means the quotes don't have anything to do with it. So I'm realllllyyyy confused. In the YAML format, I can only hit 1622 characters. Is there a php limit somewhere I don't know about?
  4. THERE'S PARENTHESIS. Ooohhh..... Okay so I need those parenthesis in the YAML to make it work right, so how would I avoid creating an issue with those?
  5. Maybe, but what do I do then? Printing $yaml into a text file results in what I want. $myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); fwrite($myfile, $yaml); fclose($myfile); Result: http://hastebin.com/ucurevadup.sm
  6. Hello! I know this seems like an easy task, using strval or casting to string, but the API I am using WON'T accept anything but a hard coded string "". I figure there has to be a way to get around this... What I have here is a method used to convert an array in to a YAML/String format for me to upload onto a server using JSONAPI, found here. I am using Spyc, as that is the only thing I have found that works for this, and it does pretty well. function pushArrayToServer($array, $api) { $yaml = Spyc::YAMLDump($array,4,60); $value = 0; while (strpos($yaml, "$value:") !== false) { $yaml = str_replace("$value:", "-", $yaml); $value = $value + 1; } $yaml = str_replace("---", "", $yaml); // Final YAML from Array var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml))); } Now the problem is that last $api->call I do. This call accepts the method type as a string(argument 1), and an array for argument two. For the method "files.write", the api requires an array being (file location, string). The string is what will be replacing the content of the file. But the only way I can get that line to work is if I do this: var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", "a string here"))); That works 100% fine, no errors. This is the dump I get when I run that. But as soon as I do one of these: var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml))); $yaml2 = $yaml . ""; var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml2))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", strval($yaml)))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", "$yaml2"))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", (string)$yaml))); These do not work. The dumps all return null. I haven't found a way yet to not do "". It almost worked once when I attempted some things, but I found out I was just converting a boolean into a string which caused an error. The server I am working with is a minecraft server with JSONAPi installed. It works great, except for this error. So I am assuming the string type has to be just like Java's, or pretty plain? I have no clue this is the first real issue I've had with this plugin. Thanks in advance, HeyAwesomePeople
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.