Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[PHP]Trying to send packets to Minecraft Server

  • Please log in to reply
1 reply to this topic


  • Location: DFW
  • Minecraft: langkid1

Posted 29 February 2012 - 01:14 AM

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?
Posted Image

Register or log in to remove.


  • Location: online
  • Minecraft: qwertyg33ks

Posted 10 March 2012 - 06:42 PM

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!
Posted Image