Very confused about code that was working yesterday and now not at all

Skip to first unread message

Rebecca Noonan

Apr 17, 2014, 8:17:23 AM4/17/14
So for the past couple of days I've been trying to get messages sent through an online form to send to my printer URL and automatically print. After much effort I finally got the PHP working last night and was over the moon. When I pressed send, the printer printed the latest message sent via the form. Set the printer up again a while ago and sent a message through the form..and nothing.. No new messages are appearing in my printer archive and I didn't touch or even open the PHP code on the webpage since last night when everything was working. There are no errors on the webpage when I send a message and messages are saving to the database but not sending to the printer anymore. Can anyone explain this?

Here is a video of it working last night:

And here's the section of PHP that was sending the messages to the archive last night:

if ($message != null) 
{$qry = "INSERT INTO names1 (name, time, date) 
$insert = mysqli_query ($db, $qry);
$id = mysqli_insert_id($db);
$printer_id = '6g2o1s6t0f4e7v4a';
$print_url = '' . $printer_id;
$fields = array(
'content' => ( '<h1>' . $message . '</h1>')

function http_post_lite($url, $data) {
    $options = array(
        'http' => array(
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
            'method'  => 'POST',
            'content' => http_build_query($data),
    $context  = stream_context_create($options);
    return $result = file_get_contents($url, false, $context);
 $response = http_post_lite($print_url, $fields);

Rebecca Noonan

Apr 17, 2014, 8:35:48 AM4/17/14
I've also just noticed that even test pages or HTML I send in my own printer backend directly ( aren't even appearing in my archive. Is there a problem with the server maybe?

James Adam

Apr 17, 2014, 9:33:54 AM4/17/14
I've just restarted the server - try again now?
You received this message because you are subscribed to the Google Groups "Printer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Rebecca Noonan

Apr 17, 2014, 10:02:36 AM4/17/14
Seems to be working now. I was going mad. Thank you!
Reply all
Reply to author
0 new messages