-2
\$\begingroup\$

How can I pull a variable located in Arduino RAM through an Ethernet Shield from my PHP (WAMP) server?

For example, I have a variable, red_led = 1, in the Arduino. How can I pull that information to my PHP server?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ This is very similar to your previous question. Are you asking about the general approach or the specifics? If it's the specifics, be more specific. What code have you tried, what problems have you encountered? electronics.stackexchange.com/questions/19854/… \$\endgroup\$ Oct 4, 2011 at 9:41
  • 2
    \$\begingroup\$ We are not the arduino help desk. \$\endgroup\$ Jul 31, 2014 at 20:38
  • \$\begingroup\$ As much as we will try to help out, Arduino questions are best handled by the Arduino.SE or the Arduino forums. Areas made specifically for Arduino questions. EE.SE is more for physical electronics design rather than Arduino web servers. \$\endgroup\$
    – Funkyguy
    Jul 31, 2014 at 21:09

1 Answer 1

2
\$\begingroup\$

If you have a public IP address in your Arduino device, you can repeatedly make requests from your WAMP server. But the Arduino has to listen on some port and respond to your request.

The better solution is, every time the variable changes its state, the Arduino connects to your WAMP server and sends the desired data. For example, it makes an HTTP GET request:

http://example.com/variable-from-arduino.php?red_led=1

And that's it. Every time, when the Arduino sends a GET request, you can process it on your server.

If you just want to print some graphs based on your variable, you can use Pachube.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks yes the GET method works, but what about POST method? example 192.168.1.35/test.php/?red_status=5 <<< this works only with GET method. but now i want to send in POST method. \$\endgroup\$
    – Theodros
    Oct 8, 2011 at 4:47
  • \$\begingroup\$ Well, GET method is more easy than POST. GET contains only HTTP header, it has no body. But if you want to use POST instead, look here — jmarshall.com/easy/http/#postmethod There is example, how POST request looks. \$\endgroup\$
    – vasco
    Oct 8, 2011 at 10:23
  • \$\begingroup\$ With POST, your data is stored in an environment variable. You will need to retrieve the "CONTENT-LENGTH" environment variable and then use that to read in the length of the contents of the environment variable your data is stored in. I don't think this would be different on the Arduino platform. \$\endgroup\$
    – Funkyguy
    Jul 31, 2014 at 21:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.