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

23 views
Skip to first unread message

Rebecca Noonan

unread,
Apr 17, 2014, 8:17:23 AM4/17/14
to gfr-p...@googlegroups.com
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:
https://www.youtube.com/watch?v=ltz-vinhIHg

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) 
VALUES ('$message', CURRENT_TIME, CURRENT_DATE);";
$insert = mysqli_query ($db, $qry);
$id = mysqli_insert_id($db);
$printer_id = '6g2o1s6t0f4e7v4a';
$print_url = 'http://printer.exciting.io/print/' . $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

unread,
Apr 17, 2014, 8:35:48 AM4/17/14
to gfr-p...@googlegroups.com
I've also just noticed that even test pages or HTML I send in my own printer backend directly (http://printer.exciting.io/my-printer/6g2o1s6t0f4e7v4a) aren't even appearing in my archive. Is there a problem with the server maybe?

James Adam

unread,
Apr 17, 2014, 9:33:54 AM4/17/14
to gfr-p...@googlegroups.com, gfr-p...@googlegroups.com
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 gfr-printer...@googlegroups.com.
To post to this group, send email to gfr-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gfr-printer.
For more options, visit https://groups.google.com/d/optout.

Rebecca Noonan

unread,
Apr 17, 2014, 10:02:36 AM4/17/14
to gfr-p...@googlegroups.com
Seems to be working now. I was going mad. Thank you!
Reply all
Reply to author
Forward
0 new messages