Hello, I'm trying to send packets to the vanilla minecraft server through PHP, right now I'm trying to just send a 0x02 handshake packet and I don't know how to send the string for my player name.
Here is my source code
function login($host, $port=25565, $timeout=10)
$fp = fsockopen($host, $port, $errno, $errstr, $timeout);//open connection
if (!$fp) return false;//return FALSE if can't open
$f = "\x02langkid1"; //How do I send user name!? This packet returns "java.io.IOException: Received string length longer than maximum allowed (8277 > 64)" on the MC server console when sent!
fwrite($fp, $f);//send $f (packet)
$d = fread($fp, 256);//attempt to read what is sent back
return $d;//attempt to return what was read
When I try that I get no page output, and this error on my server console: 'java.io.IOException: Received string length longer than maximum allowed (27745 > 64)'
What is the correct way to send playername?
Hey! I am looking for a solution to this problem, as well! I am sure that others are struggling with it, but don't really know PHP that well (ahem... ME). Please keep working away and let us know if you find a solution!