J'ai trouvé sa dans les script que Jok a mis qui je pense peut servir ::
function _sendCommand($address, $port, $command, $timeout=50000) { if(!$socket=@fsockopen('udp://'.$address, $port, $errno, $this->errstr, $this->_timeout)) { return FALSE; } else { socket_set_blocking($socket, true); // socket_set_timeout should be used here but this requires PHP >=4.3 socket_set_timeout($socket, 0, $timeout); // send command if(fwrite($socket, $command, strlen($command))==-1) { fclose($socket); $this->errstr='Unable to write on open socket!'; return FALSE; } $result=''; do { $result .= fread($socket, 128); $socketstatus = socket_get_status($socket); } while ($socketstatus['unread_bytes']); fclose($socket); if(!isset($result)) { $this->debug[] = array($command, ''); return FALSE; } $this->debug[] = array($command, $result); return $result; } }
Mais bon je comprend pas tous, quelqu'un a une idée de faire sa en plus simple ?