Need a little help

28 views
Skip to first unread message

Rebecca Noonan

unread,
Apr 15, 2014, 11:57:48 AM4/15/14
to gfr-p...@googlegroups.com
Hi!

I've set up a printer to incorporate into my final year project in college. So far I've the printer wired and everything prints fine from a test page with my printer URL. I've also set up a form where people can enter messages and they are sent to both a database and also another hidden webpage. I'm using XML in Processing to grab the newest message sent through the form that's on the hidden webpage and redirects the message to my printer backend server archive and when I run a Processing sketch, the newest message prints. I still need to figure out how to make this happen automatically actually, without having to press run in Processing when a message is sent. If anyone knows a way to do that, that would be great!

The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observatory from a telescope in America. Once the children are finished editing their individual images, they can add a message on a form, like I've done already and then I want to be able to print the image with the accompanying text when they press send. I've looked at the canvas app but is this the only image printing application I can use on my printer server?

Sorry if this is a bit long winded. Any help is appreciated!

James Adam

unread,
Apr 15, 2014, 2:05:30 PM4/15/14
to gfr-p...@googlegroups.com
Hi Rebecca,

The short answer is that you can print pretty much anything that can be part of an HTML page, so that includes images if they are part of the HTML via the `img` tag. If I were working on your project, I’d use a `file` field as part of the same form that the children add their message, so they can upload their picture with the message.

Is your software available online anywhere, like github or bitbucket? It might be easier to give constructive advice against some concrete code?

As an aside, given you’ve mentioned that these are images from space, I’d be very wary of images with a lot of black in them; these tend to cause the printer to jam :-/


— James
> --
> 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 (mailto:gfr-printer...@googlegroups.com).
> To post to this group, send email to gfr-p...@googlegroups.com (mailto: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 15, 2014, 2:23:34 PM4/15/14
to gfr-p...@googlegroups.com
Hi James,

Thanks for the reply. If that's the case with images with a lot of black in them then it won't work on the project so we'll have to leave the images part out so. I was kind of thinking the fact they were heavily black might not work anyway as it would be hard to make out smaller objects within the blackness.

On the messages side of things, at the moment I've set up a dummy webpage with a simple form for testing:

When a message is sent it goes into a database but also sends to this webpage that the user wouldn't see:

I then have Processing extracting XML data from the second link and printing it in Processing. After that, I've incorporated HTTP Requests for Processing and I'm using that to take the newest message and use a post request to my printer URL. When I run the sketch, the newest message from the form prints.

I don't have a GitHub account but the sketch I have to do this is very short. I've attached the pde file but I'll copy and paste it below too if that's easier for you.

What I want to do from here is get the Processing sketch to check if there's new messages all the time and then make the messages print automatically rather than me having to press run all the time when a new message appears.

Here's the code from my processing sketch:

XML xml;
import http.requests.*;


public void setup() {
  
  XML[] msgs = xml.getChildren("message");

  for (int i = 0; i < 1; i++) {
    String content = msgs[i].getContent();
    
    String content_styled = "<h1>" + content + "</h1>";
    println("message is :" + content );
    
    
    
    
  size(400,400);
  smooth();
  
  PostRequest post = new PostRequest("http://printer.exciting.io/print/6g2o1s6t0f4e7v4a");
  post.addData("content", content_styled); 
  post.send();
  
  }
}


Thanks,
Rebecca

On Tuesday, April 15, 2014 7:05:30 PM UTC+1, James Adam wrote:
Hi Rebecca,

The short answer is that you can print pretty much anything that can be part of an HTML page, so that includes images if they are part of the HTML via the `img` tag. If I were working on your project, I’d use a `file` field as part of the same form that the children add their message, so they can upload their picture with the message.

Is your software available online anywhere, like github or bitbucket? It might be easier to give constructive advice against some concrete code?

As an aside, given you’ve mentioned that these are images from space, I’d be very wary of images with a lot of black in them; these tend to cause the printer to jam :-/  


— James


On Tuesday, 15 April 2014 at 10:57, Rebecca Noonan wrote:

> Hi!
>  
> I've set up a printer to incorporate into my final year project in college. So far I've the printer wired and everything prints fine from a test page with my printer URL. I've also set up a form where people can enter messages and they are sent to both a database and also another hidden webpage. I'm using XML in Processing to grab the newest message sent through the form that's on the hidden webpage and redirects the message to my printer backend server archive and when I run a Processing sketch, the newest message prints. I still need to figure out how to make this happen automatically actually, without having to press run in Processing when a message is sent. If anyone knows a way to do that, that would be great!
>  
> The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observatory from a telescope in America. Once the children are finished editing their individual images, they can add a message on a form, like I've done already and then I want to be able to print the image with the accompanying text when they press send. I've looked at the canvas app but is this the only image printing application I can use on my printer server?
>  
> Sorry if this is a bit long winded. Any help is appreciated!  
>  
> --  
> 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 (mailto:gfr-printer+unsub...@googlegroups.com).
readingmessages.pde

James Adam

unread,
Apr 15, 2014, 2:52:51 PM4/15/14
to gfr-p...@googlegroups.com
Have you considered having the PHP script which receives the form data actually build the HTML and post it to the printer server directly, rather than going through Processing?



— James
> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (javascript:) (mailto:gfr-printer...@googlegroups.com (javascript:)).
> > > To post to this group, send email to gfr-p...@googlegroups.com (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:)).
> > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> 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 (mailto:gfr-printer...@googlegroups.com).
> To post to this group, send email to gfr-p...@googlegroups.com (mailto: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.
>
>
> Attachments:
> - readingmessages.pde
>



Rebecca Noonan

unread,
Apr 15, 2014, 3:17:25 PM4/15/14
to gfr-p...@googlegroups.com
I haven't thought if that no. How would I send that data to the printer from the HTML page with the messages? Not too experienced in all this so need a bit of an example
> > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (javascript:) (mailto:gfr-printer...@googlegroups.com (javascript:)).

> > > To post to this group, send email to gfr-p...@googlegroups.com (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:)).
> > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> 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 (mailto:gfr-printer...@googlegroups.com).
> To post to this group, send email to gfr-p...@googlegroups.com (mailto: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.
>
>
> Attachments:
> - readingmessages.pde
>



--
You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.

James Adam

unread,
Apr 15, 2014, 5:44:01 PM4/15/14
to gfr-p...@googlegroups.com
Can you send the source of your PHP?



— James


On Tuesday, 15 April 2014 at 14:17, Rebecca Noonan wrote:

> I haven't thought if that no. How would I send that data to the printer from the HTML page with the messages? Not too experienced in all this so need a bit of an example
>
> > > > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (javascript:;) (javascript:) (mailto:gfr-printer...@googlegroups.com (javascript:;) (javascript:)).
> > > > > To post to this group, send email to gfr-p...@googlegroups.com (javascript:;) (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:;) (javascript:)).
> > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > For more options, visit https://groups.google.com/d/optout.
> > > >
> > >
> > >
> > > --
> > > 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 (javascript:;) (mailto:gfr-printer...@googlegroups.com (javascript:;)).
> > > To post to this group, send email to gfr-p...@googlegroups.com (javascript:;) (mailto:gfr-p...@googlegroups.com (javascript:;)).
> > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > Attachments:
> > > - readingmessages.pde
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (javascript:;).
> > To post to this group, send an email to gfr-p...@googlegroups.com (javascript:;).

Rebecca Noonan

unread,
Apr 15, 2014, 5:59:41 PM4/15/14
to gfr-p...@googlegroups.com
Sure thing. They're attached to this message


To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.
form2.php
messageresults.php

James Adam

unread,
Apr 15, 2014, 6:16:36 PM4/15/14
to gfr-p...@googlegroups.com
Here’s my rough attempt, though bear in mind I haven’t actually tested this…

In the code at the top, inside the `if` statement checking whether or not there was a message parameter, add something like the following:

// send the message to the printer server
$printer_id = '6g2o1s6t0f4e7v4a';
$print_url = 'http://printer.exciting.io/print/' . $printer_id;
$fields = array(
'content' => ('<h1>' . $message . '</h1>')
]
http_post_fields ($print_url, $fields);


This does basically everything that your Processing script does, except it doesn’t need to parse any XML because it already has the data. You can read more about the `http_post_fields` function here: http://www.php.net/manual/en/function.http-post-fields.php

Hopefully this (or something very like it) will mean that messages get automatically sent to your printer immediately.


— James
> > > > > > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (javascript:;) (javascript:)).
> > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:;) (javascript:)).
> > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (javascript:;) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (javascript:;)).
> > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (javascript:;) (mailto:gfr-p...@googlegroups.com (javascript:;)).
> > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > For more options, visit https://groups.google.com/d/optout.
> > > > >
> > > > >
> > > > > Attachments:
> > > > > - readingmessages.pde
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (javascript:;).
> > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (javascript:;).
> > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > --
> > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com)).
> > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto: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.
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com).
> > To post to this group, send an email to gfr-p...@googlegroups.com (mailto: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.
>
>
> --
> 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 (mailto:gfr-printer...@googlegroups.com).
> To post to this group, send email to gfr-p...@googlegroups.com (mailto: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.
>
>
> Attachments:
> - form2.php
>
> - messageresults.php
>



Rebecca Noonan

unread,
Apr 15, 2014, 6:55:21 PM4/15/14
to gfr-p...@googlegroups.com
Hi James,

Thanks so much for that. There seems to be a parse error occuring on the highlighted line. I looked at the link you sent and I tried giving the HTTP post fields a variable name but it doesn't seem to work either. I also changed a ] to a ) from your code.

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>')
)

$http_response = http_post_fields ($print_url, $fields);

}


To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.

James Adam

unread,
Apr 15, 2014, 7:03:55 PM4/15/14
to gfr-p...@googlegroups.com
The square brackets came straight from the PHP example code. Is it perhaps a missing semicolon at the closing parenthesis of the ‘array’ function call?



— James


On Tuesday, 15 April 2014 at 17:55, Rebecca Noonan wrote:

> Hi James,
>
> > > > > > > > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (javascript:;) (javascript:)).
> > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:;) (javascript:)).
> > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (javascript:;) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (javascript:;)).
> > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (mailto:gfr-p...@googlegroups.com (javascript:;)).
> > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > >
> > > > > > >
> > > > > > > Attachments:
> > > > > > > - readingmessages.pde
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (javascript:;).
> > > > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;).
> > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com))).
> > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)).
> > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > >
> > >
> > >
> > > --
> > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com)).
> > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto: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 15, 2014, 7:14:50 PM4/15/14
to gfr-p...@googlegroups.com
Changed it back to a square bracket and added a semi colon, it didn't work. Changed it back to an ordinary bracket with a semi colon and the error is gone and the form is showing up now which is good news.

Bad news.. I think I left my adapter to power my arduino in college today so I won't be able to test until tomorrow but it's looking good.

I appreciate your help so much!


To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.

Rebecca Noonan

unread,
Apr 16, 2014, 8:09:11 AM4/16/14
to gfr-p...@googlegroups.com
Hi James,

When I was sending data through the form last night, an error showed up that http_post_field was undefined. It seems to be out of date or something?

I've worked on it this morning. Now there are no errors showing up when I send messages in the form but nothing is sending to my printer URL archive. Can you spot anything wrong in this new block of code that I'm using to try to send the message to the printer URL?

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($print_url, $data) {
$opts = array('http' => $data);

$st = stream_context_create($opts);
$fp = fopen($print_url, 'rb', false, $st);

if(!$fp) {
return false;
}
return stream_get_contents($fp);
}
$response = http_post_lite($print_url, $fields);
}

James Adam

unread,
Apr 16, 2014, 12:28:46 PM4/16/14
to gfr-p...@googlegroups.com
Just double checking here, but you did use `http_post_fields` (plural), rather than `http_post_field` (singular)? It seems this isn’t built in to PHP though; it’s an extension.

Unfortunately, I’m not a PHP expert; anyone else on this list know enough PHP to help?


— James


On Wednesday, 16 April 2014 at 07:09, Rebecca Noonan wrote:

> Hi James,
>
> > > > > > > > > > > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (javascript:;) (javascript:)).
> > > > > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:;) (javascript:)).
> > > > > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (javascript:;) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (javascript:;)).
> > > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (mailto:gfr-p...@googlegroups.com (javascript:;)).
> > > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Attachments:
> > > > > > > > > > - readingmessages.pde
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > > > > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > > > > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (javascript:;).
> > > > > > > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;).
> > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)))).
> > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))).
> > > > > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com))).
> > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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 16, 2014, 1:04:55 PM4/16/14
to gfr-p...@googlegroups.com
Tried changing it to singular http_post_field there but it didn't seem to work. It was suggesting the plural. 

I can try to get someone with a better knowledge of PHP to take a look at it possibly.

You can't think of any other way to do this through Processing?


To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.

James Adam

unread,
Apr 16, 2014, 1:11:40 PM4/16/14
to gfr-p...@googlegroups.com
Just for the avoidance of doubt, it’s the plural version that appears in the documentation, so if the plural version doesn’t work, it probably means that you don’t have the HTTP extension installed on your system. I’ve asked on Twitter for ideas.

The problem with Processing is, as far as I know, there’s no simple way of running it automatically; it’s just not what Processing was designed for.


— James
> > > > > > > > > > > > > > The main reason I'm posting is to ask about printing images. For the project, children manipulate an image from space sent to an observa> > > To unsubscribe from this group and stop receiving emails from it, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (mailto:gfr-printer...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))) (javascript:;) (javascript:)).
> > > > > > > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (javascript:) (mailto:gfr-p...@googlegroups.com (javascript:;) (javascript:)).
> > > > > > > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))) (javascript:;) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))) (javascript:;)).
> > > > > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;) (mailto:gfr-p...@googlegroups.com (javascript:;)).
> > > > > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Attachments:
> > > > > > > > > > > > - readingmessages.pde
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > > > > > > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > > > > > > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))) (javascript:;).
> > > > > > > > > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (javascript:;).
> > > > > > > > > > > Visit this group at http://groups.google.com/group/gfr-printer.
> > > > > > > > > > > For more options, visit https://groups.google.com/d/optout.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > 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 (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))) (mailto:gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com))))).
> > > > > > > > > > To post to this group, send email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to a topic in the Google Groups "Printer" group.
> > > > > > > > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/gfr-printer/n_stuS_Rldg/unsubscribe.
> > > > > > > > > To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com (mailto:gfr-printer%2Bunsu...@googlegroups.com) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com)) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com))) (mailto:gfr-printer%2Bunsu...@googlegroups.com (mailto:gfr-printer%252Buns...@googlegroups.com) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com)) (mailto:gfr-printer%252Buns...@googlegroups.com (mailto:gfr-printer%25252Bun...@googlegroups.com) (mailto:gfr-printer%25252Bun...@googlegroups.com (mailto:gfr-printer%2525252Bu...@googlegroups.com)))).
> > > > > > > > > To post to this group, send an email to gfr-p...@googlegroups.com (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto:gfr-p...@googlegroups.com) (mailto: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.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the Google Groups "Printer" group.

Rebecca Noonan

unread,
Apr 16, 2014, 1:20:16 PM4/16/14
to gfr-p...@googlegroups.com
Thanks for asking about it.

What do you think about coming up with some sort of draw loop in processing to check for new messages? Or will that keep trying to initiate the printer to print the same message over and over again?


To unsubscribe from this group and all its topics, send an email to gfr-printer...@googlegroups.com.
To post to this group, send an email to gfr-p...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages