Solved WebSend

Discussion in 'Spigot Help' started by Seff300, Feb 18, 2018.

Thread Status:
Not open for further replies.
  1. Hello! I have a question how to setup Websend with bungeecord. I currently have websend installed in all of my Spigot servers and connected with the website. And works fine. But my problem is that it only executes that command in the server where the player is. But I want it to execute that command in all the Spigot servers

    My php script:
    Code (Text):
    <?php
        require_once 'Websend.php';
        $message = $_GET ['message'];
        $ws = new Websend("this.is.notmyrealsite");

        $ws->password = "*******";

        if($ws->connect()){
            $ws->doCommandAsConsole("pex user "."$message"." group add vip 25920000");
            echo "Thank you.";
        }else{
            echo "Failed to connect.";
        }
        $ws->disconnect();
    ?>

     
     
  2. Assuming you're using this...
    https://www.spigotmc.org/resources/websender-send-command-with-php-bungee-and-bukkit-support.33909/

    If so it seems as simple as doing something like this:


    Code (Text):
    $wsr = new WebsenderAPI("127.0.0.1","123qwe","9876"); // HOST , PASSWORD , PORT | Server 1
    $wsr2 = new WebsenderAPI("127.0.0.1","123qwe","9877"); // HOST , PASSWORD , PORT | Server 2
    $wsr3 = new WebsenderAPI("127.0.0.1","123qwe","9878"); // HOST , PASSWORD , PORT | Server 3

        if($wsr->connect()){

            $wsr->sendCommand("gamemode 1 CraftRise");
            $wsr2->sendCommand("gamemode 1 CraftRise");
            $wsr3->sendCommand("gamemode 1 CraftRise");

        }else
            echo "Connection error! Check info.";

        $wsr->disconnect();
        $wsr2->disconnect();
        $wsr3->disconnect();
     
  3. Might do the trick:


    Code (Text):
    <?php
        require_once 'Websend.php';
        $message = $_GET ['message'];
        $ws = new Websend("server1IP");
        $ws2 = new Websend("server2IP");
        $ws3 = new Websend("server3IP");

        $ws->password = "*******";
        $ws2->password = "*******";
        $ws3->password = "*******";

        if($ws->connect()){
            $ws->doCommandAsConsole("pex user "."$message"." group add vip 25920000");
            echo "Thank you.";
        }else{
            echo "Failed to connect.";
        }
        $ws->disconnect();
       
            if($ws2->connect()){
            $ws2->doCommandAsConsole("pex user "."$message"." group add vip 25920000");
            echo "Thank you.";
        }else{
            echo "Failed to connect.";
        }
        $ws2->disconnect();
       
        if($ws3->connect()){
            $ws3->doCommandAsConsole("pex user "."$message"." group add vip 25920000");
            echo "Thank you.";
        }else{
            echo "Failed to connect.";
        }
        $ws3->disconnect();
    ?>
     
     
  4. Then it says Failed to connect.
     
  5. I think the problem is in the Websend.php file becuase it only accepts one port
    Code (Text):
                    var $host;
                    var $port;
                    var $stream;

                    public function __construct($host, $port = 4445)
                    {
                            $this->host = $host;
                            $this->port = $port;
                    }

                    public function __destruct(){
                    if($this->stream){
                    $this->disconnect();
                    }
            }
     
    How do I make it accept multiple ports?
     
  6. I tried using WebSender but it only executed the command in one server. And what IP I have to use for the host the website ip or the server's ip? Console says [20:21:50 INFO]: User "e6db6c6c-4da4-4bc0-877c-b7d4535a025d/e6db6c6c-4da4-4bc0-877c-b7d4535a025d" added to group "Vip"! But when i do /pex user Seff300 then it doesn't show that I'm in the VIP group.
     
    #6 Seff300, Feb 18, 2018
    Last edited: Feb 18, 2018
  7. I fixed the problem by myself by adding
    if($wsr->connect()){
    if($wsr2->connect());
    if($wsr3->connect());
     
Thread Status:
Not open for further replies.