requsting to execute php script

Discussion in 'Spigot Plugin Development' started by 69economy, Aug 17, 2018.

  1. Hello, I'm trying to create a web administration on the server but also to control it directly from the server. (I have personal reasons and I'm learning to do so) php-> rcon script already working, but I have a problem with how to recall it and send other data.

    Currently i have this, but its not working without any error.
    Code (Text):

    public class eBan implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("eban")){
                Player player = (Player) sender;
                try {
                    URL url = new URL("");
                     URLConnection connection = url.openConnection();

                       OutputStreamWriter out = new OutputStreamWriter(
                       out.write("?name=" + args[0]);
                } catch (IOException e) {
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), e.toString() );
            return true;
    #1 69economy, Aug 17, 2018
    Last edited: Aug 17, 2018
  2. What you are doing is sending "?name=<some name>" in raw directly via tcp to the server, port 80, instead of including in the HTTP request.
    So do that.
  3. What's so hard about sending a simple http request to a website? You don't write something over a stream, but rather use a buildin class provided by the libary. If you don't know one, look for one, like this here: