Level 58
It's possible that the printer is not receiving the correct data format. Try converting the string to a format that the printer can understand, such as ZPL or EPL. You can also try sending a test print command to the printer to see if it responds. Here's an example of how to send a ZPL command to a printer:
<?php
$imprimir="^XA^FO50,50^ADN,36,20^FDHello World^FS^XZ";
try {
$fp=pfsockopen("192.168.0.18", 9100);
fputs($fp, $imprimir);
fclose($fp);
echo 'Success!!';
} catch (Exception $e) {
echo 'Problem: ', $e->getMessage(), "\n";
}
This code sends a ZPL command to print "Hello World" on the printer. If this works, you can modify the command to print whatever you need.