Use console command send API #290
Replies: 6 comments 1 reply
-
SirCoolness wrote at Jun 17 2016 13:42:34 UTC: I havent looked much at the remote part of the server but i may have an idea. Go to your puffer panel files and try to find the file with submits the commands to the console. Try to find what method it uses and once you do mimick the method but with your style. If i have time ill try doing it myself. |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC: Well what I mostly needed was a POST example for it, like the docs for getting logs and such provide. I think I've found something. |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC: OK, I managed to put something together using the provided GET files, some Google, some chatrooms and the generic /server POST example, but it doesn't fully work. Currently I have:
It doesn't return any errors, but the console log tells me "command not found," which must mean I'm sending the data incorrectly. I'm sending a form value through an AJAX request to PHP. I know it gets to the PHP variable, because sending it back to JS and printing it out returns the correct value. I can only think I'm not sending this correctly. I have no idea how to read the PHP files in PP, or even where to look. It'd be amazing if maybe puffrfish or someone else could help out. |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC: Here's my complete code, which sends a The HTML/JS:
The PHP (with the keys taken out):
I really need help with this. I have no idea where I might find the files that deal with this request, or what to look for if I find them. |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC: I got it to work! I looked at the source for PP and found the code for the bulk command sender. I used the below snippet and modified it with a static URL and tokens to work:
My complete (fixed) code, if anyone wants it: The HTML/JS:
/php/bungeesend.php
Unirest needs to be installed to the webserver somewhere. |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC: So 1.0.0 will most likely break this code, which I don't mind, as it is most likely going to be much easier to use the API. Since there's also most likely going to be fuller documentation, I won't have to go through this trouble again. Can't wait to upgrade, break my code, and learn some more PHP :) |
Beta Was this translation helpful? Give feedback.
-
zacharee wrote at Jun 17 2016 13:42:34 UTC:
I'm playing around with the Remote Requests feature on PufferPanel, trying to make a page with all my servers displayed at once.
I have the log view and power controls working, but only because PHP code was provided for them.
There's no documentation on /server/console, and I have no experience in PHP, so I don't know how to POST data through it. How can I do this?
Beta Was this translation helpful? Give feedback.
All reactions