Sol Reklam
Sağ Reklam

Websend hatası

Durum
Mesaj gönderimine kapalı.

RaeLight

Back End Developer

Discord:

RaeLight#1932

Katılım
9 Mayıs 2018
Mesajlar
39
Elmaslar
31
Puanlar
6.220
Minecraft
RaeLight
Sunucuya websend ile komut göndermeye çalışırken aşağıdaki hatayı veriyor
hata_1.png

bir kaç gündür sorunun sebebini aradım bulamadım

hata_2.png


bu kod ile sunucuya komut göndermeye çalışıyorum
PHP:
<?php
    /*
     *  Writted by Waterflames for the Websend project
     *  (Project page: http://dev.bukkit.org/bukkit-plugins/websend/)
     *  See https://github.com/Waterflames/Websend/blob/master/package/Websend.php for commits by other users.
     */
    class Websend
    {
        public $timeout = 3600;/* Connection timeout as defined in fsockopen */
        public $password = "";/* Password in Websend server config */
        public $hashAlgorithm = "sha512";
       
        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();
            }
        }

        /**
        * Connects to a Websend server.
        * Returns true if successful.
        */
        public function connect()
        {
            $this->stream = fsockopen($this->host, $this->port,$errno,$errstr,$this->timeout);
            if($this->stream){
                $this->writeRawByte(21);
                $this->writeString("websendmagic");
                $seed = $this->readRawInt();
                $hashedPassword = hash($this->hashAlgorithm, $seed.$this->password);
                $this->writeString($hashedPassword);
                $result = $this->readRawInt();
                if($result == 1){
                    return true;
                }else{
                    return false;
                }
            }else{
                return false;
            }
        }

        /**
        * Sends a disconnect signal to the currently connected Websend server.
        */
        public function disconnect()
        {
            $this->writeRawByte(20);
        }

        //NETWORK IO
        private function writeRawInt( $i )
        {
            fwrite( $this->stream, pack( "N", $i ), 4 );
        }
   
        private function writeRawDouble( $d )
        {
            fwrite( $this->stream, strrev( pack( "d", $d ) ) );
        }

        private function writeRawByte( $b )
        {
            fwrite( $this->stream, strrev( pack( "C", $b ) ) );
        }

        private function writeChar( $char )
        {
            $v = ord($char);
            $this->writeRawByte((0xff & ($v >> 8)));
            $this->writeRawByte((0xff & $v));
        }

        private function writeChars( $string )
        {
            $array = str_split($string);
            foreach($array as &$cur)
            {
                $v = ord($cur);
                $this->writeRawByte((0xff & ($v >> 8)));
                $this->writeRawByte((0xff & $v));
            }
        }

        private function writeString( $string )
        {
            $array = str_split($string);
            $this->writeRawInt(count($array));
            foreach($array as &$cur)
            {
                $v = ord($cur);
                $this->writeRawByte((0xff & ($v >> 8)));
                $this->writeRawByte((0xff & $v));
            }
        }

        private function readRawInt()
        {
            $a = $this->readRawByte();
            $b = $this->readRawByte();
            $c = $this->readRawByte();
            $d = $this->readRawByte();
            $i = ((($a & 0xff) << 24) | (($b & 0xff) << 16) | (($c & 0xff) << 8) | ($d & 0xff));
            if($i > 2147483648){
                 $i -= 4294967296;
             }
            return $i;
        }
        private function readRawDouble()
        {
            $up = unpack( "di", strrev( fread( $this->stream, 8 ) ) );
            $d = $up["i"];
            return $d;
        }
        private function readRawByte()
        {
            $up = unpack( "Ci", fread( $this->stream, 1 ) );
            $b = $up["i"];
            if($b > 127){
                $b -= 256;
            }
            return $b;
        }
        private function readRawUnsignedByte()
        {
            $up = unpack( "Ci", fread( $this->stream, 1 ) );
            $b = $up["i"];
            return $b;
        }
        private function readChar()
        {
            $byte1 = $this->readRawByte();
            $byte2 = $this->readRawByte();
            $charValue = chr(utf8_decode((($byte1 << 8) | ($byte2 & 0xff))));
            return $charValue;
        }
        private function readChars($len)
        {
            $buf = "";
            for($i = 0;$i<$len;$i++)
            {
                $byte1 = $this->readRawByte();
                $byte2 = $this->readRawByte();
                $buf = $buf.chr(utf8_decode((($byte1 << 8) | ($byte2 & 0xff))));
            }
            return $buf;
        }

        //WEBSEND SPECIFIC

        /**
        * Run a command as if the specified player typed it into the chat.
        *
        * @param string $cmmd Command and arguments to run.
        * @param string $playerName Exact name of the player to run it as.
        * @return true if the command and player were found, else false
        */
        public function doCommandAsPlayer($cmmd, $playerName)
        {
            $this->writeRawByte(1);
            $this->writeString($cmmd);
            if(isset($playerName))
            {
                $this->writeString($playerName);
            }
            else
            {
                $this->writeString("null");
            }

            if($this->readRawInt() == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /**
        * Run a command as if it were typed into the console.
        *
        * @param string $cmmd Command and arguments to run.
        * @return true if the command was found, else false
        */
        public function doCommandAsConsole($cmmd)
        {
            $this->writeRawByte(2);
            $this->writeString($cmmd);

            if($this->readRawInt() == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /**
        * Run a script.
        * The script has to be in the Websend scripts directory and has to be compiled and loaded before this is runned.
        *
        * @param string $scriptName Name of the script.
        */
        public function doScript($scriptName)
        {
            $this->writeRawByte(3);
            $this->writeString($scriptName);
        }
       
        /**
        * Start plugin output capture
        *
        * @param string $pluginName Name of the plugin.
        */
        public function startPluginOutputListening($pluginName)
        {
            $this->writeRawByte(4);
            $this->writeString($pluginName);
        }
       
        /**
        * Stop plugin output capture
        *
        * @param string $pluginName Name of the plugin.
        * @return array of strings that contains output.
        */
        public function stopPluginOutputListening($pluginName)
        {
            $this->writeRawByte(5);
            $this->writeString($pluginName);
            $size = $this->readRawInt();
            $data = array();
            for($i = 0; $i<$size;$i++){
                $messageSize = $this->readRawInt();
                $data[$i] = $this->readChars($messageSize);
            }
            return $data;
        }
       
        /**
        * Print output to the console window. Invisible to players.
        */
        public function writeOutputToConsole($message)
        {
            $this->writeRawByte(10);
            $this->writeString($message);
        }

        /**
        * Prints output to specified player.
        *
        * @param string $message Message to be shown.
        * @param string $playerName Exact name of the player to print the message to.
        * @return true if the player was found, else false
        */
        public function writeOutputToPlayer($message, $playerName)
        {
            $this->writeRawByte(11);
            $this->writeString($message);
            if(isset($playerName))
            {
                $this->writeString($playerName);
            }
            else
            {
                $this->writeString("null");
            }

            if($this->readRawInt() == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /**
        * Prints a message to all players and the console.
        *
        * @param string $message Message to be shown.
        */
        public function broadcast($message)
        {
            $this->writeRawByte(12);
            $this->writeString($message);
        }
    }
?>
yardım ederbilir misiniz?
 

IExlusive

Egemenlik, kayıtsız şartsız ulusundur.
MinePass
Premium
Emektar
Katılım
5 Eylül 2015
Mesajlar
435
Elmaslar
208
Puanlar
14.070
Yer
İzmir
35.satırda ki koda baktın mı ?
 

RaeLight

Back End Developer

Discord:

RaeLight#1932

Katılım
9 Mayıs 2018
Mesajlar
39
Elmaslar
31
Puanlar
6.220
Minecraft
RaeLight

GameUx Studios

Poyraz HANCILAR
Katılım
26 Ocak 2017
Mesajlar
125
Elmaslar
61
Puanlar
8.990
evet baktım bağlantı fonksiyonunda ki fsockopen satırında hata veriyor neden hata verdiğini anlamadım

PHP hakkında bilgim var. Ayrıca daha önce WebSend kullandım. İstersen sana yardım edebilirim.

Discord: PlayersNewAge#6196
 

frmlans

Bir Kömür Göründü Kaptanım!
Katılım
12 Temmuz 2015
Mesajlar
132
Elmaslar
68
Puanlar
13.670

GameUx Studios

Poyraz HANCILAR
Katılım
26 Ocak 2017
Mesajlar
125
Elmaslar
61
Puanlar
8.990
Burdan yardımcı olursan herkes öğrenebilir.

Sadece websend.php dosyası paylaşılmış, ayrıca Minecraft.php dosyasını da görmem gerekiyor. Belki dosyalarda hata olmasa bile yaptığı bir sistemde hata vardır, bunu şu anda bilmiyorum. Zaten çözümünü bulduğum hataları bir Rehber şeklinde paylaşabilirim.
 

RaeLight

Back End Developer

Discord:

RaeLight#1932

Katılım
9 Mayıs 2018
Mesajlar
39
Elmaslar
31
Puanlar
6.220
Minecraft
RaeLight
minecraft.php dosyasını kullanmıyorum o dosya gerekli mi
 

frmlans

Bir Kömür Göründü Kaptanım!
Katılım
12 Temmuz 2015
Mesajlar
132
Elmaslar
68
Puanlar
13.670

RaeLight

Back End Developer

Discord:

RaeLight#1932

Katılım
9 Mayıs 2018
Mesajlar
39
Elmaslar
31
Puanlar
6.220
Minecraft
RaeLight
biraz düzenledim çalışıyormu bilmiyorum
<?php
class Websend
{
public $timeout = 3600;

var $host;
var $password;
var $port;
var $stream;

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

public function __destruct(){
if($this->stream)
$this->disconnect();
}

/**
* Connects to a Websend server.
* Returns true if successful.
*/
public function connect()
{
@$this->stream = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
if($this->stream){
@$this->writeRawByte(21);
@$this->writeString(hash("SHA512", $this->readRawInt().$this->password));
return $this->readRawInt() == 1 ? true: false;
}else{
return false;
}
}

/**
* Sends a disconnect signal to the currently connected Websend server.
*/
public function disconnect()
{
$this->writeRawByte(20);
}

//NETWORK IO
private function writeRawInt( $i )
{
@fwrite( $this->stream, pack("N", $i), 4);
}

private function writeRawDouble( $d )
{
fwrite( $this->stream, strrev(pack("d", $d)));
}

private function writeRawByte( $b )
{
@fwrite( $this->stream, strrev(pack("C", $b)));
}

private function writeChar( $char )
{
$v = ord($char);
$this->writeRawByte((0xff & ($v >> 8)));
$this->writeRawByte((0xff & $v));
}

private function writeChars( $string )
{
$array = str_split($string);
foreach($array as &$cur)
{
$v = ord($cur);
$this->writeRawByte((0xff & ($v >> 8)));
$this->writeRawByte((0xff & $v));
}
}

private function writeString( $string )
{
$array = str_split($string);
$this->writeRawInt(count($array));
foreach($array as &$cur)
{
$v = ord($cur);
$this->writeRawByte((0xff & ($v >> 8)));
$this->writeRawByte((0xff & $v));
}
}

private function readRawInt()
{
$a = $this->readRawByte();
$b = $this->readRawByte();
$c = $this->readRawByte();
$d = $this->readRawByte();
$i = ((($a & 0xff) << 24) | (($b & 0xff) << 16) | (($c & 0xff) << 8) | ($d & 0xff));
if($i > 2147483648){
$i -= 4294967296;
}
return $i;
}
private function readRawDouble()
{
$up = unpack( "di", strrev( fread( $this->stream, 8 ) ) );
$d = $up["i"];
return $d;
}
private function readRawByte()
{
$up = unpack( "Ci", fread( $this->stream, 1 ) );
$b = $up["i"];
if($b > 127){
$b -= 256;
}
return $b;
}
private function readRawUnsignedByte()
{
$up = unpack( "Ci", fread( $this->stream, 1 ) );
$b = $up["i"];
return $b;
}
private function readChar()
{
$byte1 = $this->readRawByte();
$byte2 = $this->readRawByte();
$charValue = chr(utf8_decode((($byte1 << 8) | ($byte2 & 0xff))));
return $charValue;
}
private function readChars($len)
{
$buf = "";
for($i = 0;$i<$len;$i++)
{
$byte1 = $this->readRawByte();
$byte2 = $this->readRawByte();
$buf = $buf.chr(utf8_decode((($byte1 << 8) | ($byte2 & 0xff))));
}
return $buf;
}

//WEBSEND SPECIFIC

/**
* @param string $cmmd Command and arguments to run.
* @return true if the command was found, else false
*/
public function doCommandAsConsole($cmmd)
{
$this->writeRawByte(2);
$this->writeString($cmmd);
return $this->readRawInt() == 1 ? true: false;
}

/**
* Print output to the console window. Invisible to players.
*/
public function writeOutputToConsole($message)
{
$this->writeRawByte(10);
$this->writeString($message);
}
}
?>
 

GameUx Studios

Poyraz HANCILAR
Katılım
26 Ocak 2017
Mesajlar
125
Elmaslar
61
Puanlar
8.990
minecraft.php dosyasını kullanmıyorum o dosya gerekli mi

En son sürümde gerekiyor, ayrıca discord üzerinden eklersen sana daha detaylı anlatabilirim.

Discord: PlayersOfNewAge#6196
 

frmlans

Bir Kömür Göründü Kaptanım!
Katılım
12 Temmuz 2015
Mesajlar
132
Elmaslar
68
Puanlar
13.670
En son sürümde gerekiyor, ayrıca discord üzerinden eklersen sana daha detaylı anlatabilirim.

Discord: PlayersOfNewAge#6196
Böyle bir şey söz konusu değil. Son sürümü kullanıyorum minecraft.php de yok dosyalarımda.
 

GameUx Studios

Poyraz HANCILAR
Katılım
26 Ocak 2017
Mesajlar
125
Elmaslar
61
Puanlar
8.990
Böyle bir şey söz konusu değil. Son sürümü kullanıyorum minecraft.php de yok dosyalarımda.

Emin misin? Spigot üzerinden indirdiğim Websend içinde Minecraft.php zorunlu ayrıca Websend.php Namespace olarak Minecraft kullanıyor bu yüzden gerekli.
 

frmlans

Bir Kömür Göründü Kaptanım!
Katılım
12 Temmuz 2015
Mesajlar
132
Elmaslar
68
Puanlar
13.670
Emin misin? Spigot üzerinden indirdiğim Websend içinde Minecraft.php zorunlu ayrıca Websend.php Namespace olarak Minecraft kullanıyor bu yüzden gerekli.
Hayır gerekli değil. Sunucularımda websend (son sürüm) kurulu ve websitemde sadece websend.php var.
 
Durum
Mesaj gönderimine kapalı.
Neden altınlarını Discord sunucumuzda kazmıyorsun? TIKLA VE KATIL!
Yukarı