<?php

function pole_display_price($label, $price) {
  if (!function_exists('socket_create')) return;
  if (!defined('POLE_SERVER')) return;

  $sock= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  /* Set 1 sec timeout to avoid getting stuck, should be plenty long enough */
  socket_set_option($sock, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1,
                                                          'usec' => 0));
  if (@socket_connect($sock,  POLE_SERVER, 1888)) {
    socket_write($sock,
                 sprintf("\x0a\x0d%-19.19s\x0a\x0d$%18.2f ",
                         $label, $price));
  }
}

<?php

function pole_display_price($label, $price) {
  if (!defined('POLE_SERVER')) {
    error_log("POLE_SERVER not configured");
    return;
  }

  $sock= fsockopen(POLE_SERVER, 1888, $errno, $errstr, 1);
  if ($sock) {
    fwrite($sock, sprintf("\x0a\x0d%-19.19s\x0a\x0d$%18.2f ", $label, $price));
  }
}

Use fsockopen() instead of socket functions
Use fsockopen() instead of socket functions
