Sign up ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

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?

share|improve this question

closed as off-topic by Olin Lathrop, Vladimir Cravero, placeholder, Daniel Grillo, Matt Young Jul 31 '14 at 23:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on the use of electronic devices are off-topic as this site is intended specifically for questions on electronics design." – Olin Lathrop, Vladimir Cravero, placeholder, Daniel Grillo, Matt Young
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
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/… –  Toby Jaffey Oct 4 '11 at 9:41
2  
We are not the arduino help desk. –  Olin Lathrop Jul 31 '14 at 20:38
    
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. –  Funkyguy Jul 31 '14 at 21:09

1 Answer 1

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.

share|improve this answer
    
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. –  Theodros Oct 8 '11 at 4:47
    
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. –  vasco Oct 8 '11 at 10:23
    
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. –  Funkyguy Jul 31 '14 at 21:08

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