I’d like to ask advice on what approach/package to use for the following task:
I have a pi with openFrameworks inside a Network. I have a Computer running a CMS (TYPO3) without openFramewoks in the same Network. I now like to trigger the pi from the CMS directly, that is, by using php/html.
Your TYPO3 app could publish a page with a message, and the raspberry could read that message.
Have a look at this ofHttpRequest and ofHttpResponse, and at some thread in the forum searching for this keywords, like this Raspberry Pi2 problems with HTTP requests
Thanks edapx!
I checked into this and it would definetely be a possibility. But if I understand correct, this means that my pi would continously call a web page, so causes traffic all day long. Because I have to work in a busy network, I hope to find a possibility where the php does the call, only if necessary. And the pi just waits for being pinged.
Is there an approach for this, too?
similar to thomas’ suggestion: i’ve used a lightweight command line osc sender which was triggered from a php page using the php’s shell_exec function. (in php: shell_exec (’./oscSender localhost 7777 /doThisThing’);
The OF app used ofxOscReceiver to receive the php triggers.
Hi all, OSC is tempting but as far as I understood the php version is using UPD, not TCP as Protocol. For I have a busy network and I will need error checking this is not the way to go. I’ll learn about networks, ofxHttpServer and ofxHttp and keep you updated - in case I find a solution.
Thanks to all who helped me in this. Here’s what I did:
I set up an App with ofxHTTP. I basically used the example for Basic Post Server. Inside this there is a function called:
which is triggered every time a POST form is sent. In this funtion I also get the arguments transmitted by the form. So the solution is easy in the end:
I change the form which is provided by the example to a very simple Form only using one hidden field. I then use Javascript to read the arguments I pass in an URL, fill these arguments to the hidden field and send the form.
Javascript reads the arguments ("?videoId=2"), prepares them, fills the value “2” in the hidden field and sends the form. In openFrameworks the function “onHTTPPostEvent” is fired, I get a string like
run_video=2
as argument. I just have to prepare it again and that’s it: I can trigger an event by calling a URL and pass on a variable at the same time.