INSERT COIN: A Little Office Fun With HP LaserJet Printers


Tue May 05 09:45:00 2009 -0700

It may be more than a month past April Fools’ Day, but there’s never a bad time for a little humor and laughter around the office. After reading this post, I decided to see if this innocent little trick with HP LaserJets actually works. Sure enough, it does! Using this Perl script, you can make the LCD screen on your HP LaserJet say whatever you want.

And to top it all off, I successfully ported the app to PHP and put a nice little front end on it for your added enjoyment.

Have fun, and remember, always understand what you’re doing. If your IT department frowns upon stuff like this (what do they not frown upon, right?) then you should probably think twice before trying this at the office.



function showUI($ip="",$msg="INSERT COIN",$status=""){
 <head><title>Set HP Printer Display Message</title></head>
    ?><h2><?= $status; ?></h2><?
  <form method="post" action="<?= $_SERVER['PHP_SELF']; ?>">
   <strong>Printer IP Address:</strong><br/>
   <input type="text" size="20" name="ip" value="<?= $ip; ?>">
   <strong>Display Message:</strong><br/>
   <input type="text" size="50" name="msg" value="<?= $msg; ?>">
   <input type="submit" value="Set Message!">

if( !empty($_POST['ip']) && !empty($_POST['msg']) ) {

  $ip = $_POST['ip'];
  $msg = $_POST['msg'];
  $msg = addslashes($msg);

  if (($longip = ip2long($ip)) !== false) {
    if ($ip != long2ip($longip)) {
       die("Invalid IP Entered!");
  } else {
    die("Invalid IP Entered!");

  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  if ($socket === false) {
     die("socket_create() failed!");

  $connection = socket_connect($socket, $ip, PORT);
  if ($connection === false) {
     die("socket_connect() failed!");

  $out = "@PJL RDYMSG DISPLAY=\"$msg\"\r\n";
  socket_write($socket, $out, strlen($out));

  showUI($_POST['ip'], $_POST['msg'], "Message set successfully!");

} else {


You can download the PHP here too.

Tested and works on the following printers:

  • HP Color LaserJet 5550hdn
  • HP Color LaserJet 4700
  • HP LaserJet 4350
  • HP LaserJet 9000mfp

Power cycle the printer to return the message to the “default”.

Be safe you crazy kids.

hp php printers