Read Arduino sensors status from a remote Server

Goodnight to all of you.
I'm trying to find out a solution that can make me read Arduino sensors status from a remote Server.

I've an Ubuntu Server w/Apache and some php pages that works inside a sort of webapp that provide some interfaces to Arduino (w/eth Shield) via network (turn on /off lights etc).

I've also 4 Reed Sensors attached to the arduino board. On serial monitor (via USB+Arduino IDE) I can see status value and I can print it out to the Arduino local webpage (thanks to webduino library).

My goal is to get back these value on a php page installed on the Remote Ubuntu Server (without pointing to the real Arduino Webserver). Like a backend call that "read" status of the sensors and - in case value is OPEN - put this value into the pho page mentioned above.

This is my first time approaching this kind of solution and I'm not sure how to manage and which is the best way: if Arduino POST a value into the remote Server webpage OR if Remote Webserver run a GET versus Arduino local webpage where status are printed out.

Sorry for my English :slight_smile:

Thanks in advance for your support
Best regards

Usually, the easiest way for the Arduino to tell the Ubuntu web server something is for Arduino to perform a GET request with a parameter string. Whenever one of the reed switches changes status, hit a page on the web site that will take and persist the data. Then whenever Apache has to serve up the state of the reed switches, it already knows.

However, if the Arduino is down for some reason or the network connection isn't working, you would be reporting the last known status rather than what's actually happening now. If that's a problem, you would be better off having Ubuntu scrape a page from the Arduino web server.

thanks so much for your support.

One question: moving around the web, I've found out following statement "POST is used to send data to a server to create/update a resource. For example, publish sensor readings to a server". Is this an alternative way or the GET one remains, in your opinion, the best/quickest?

GET solutions means that - from arduino - I'll perform a GET request versus the Ubuntu Apache server, pointing to a specific page requesting a particular parameter value, am I right? But, from my pov, I need to update this a POST sounds good enough. Or maybe I am confused....

Thank so much...once more :slight_smile:
Best regards