Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending data to a web page from a microcontroller, Help!

Status
Not open for further replies.

franklin97355

Technical User
Jul 11, 2002
3,753
US
Is there a way to send this to a web server from a microcontroller? I am trying to send this to a weather site without having to have my main computer on to do it. I don't know how to format the information I send.
Code:
[URL unfurl="true"]http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc=2000-01-01+10%3A32%3A35&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw[/URL]

Any help is appreciated and thanks.


The answer is "42"
 
If your microcontroller has a TCP/IP stack you would connect from an ephemeral port (1025 or higher) to port 80 on weatherstation.wunderground.com. I am assuming that your stack will understand that it needs to do a DNS lookup to resolve the name to an IP address.

Once the microcontroller connects to the web server on port 80, you will need to send the following:

Code:
GET /weatherstation/updateweathe...(rest of URL deleted) HTTP/1.1
Host: weatherstation.wunderground.com

There is a carriage return required at the end of each line and then one on a line by itself in order to let the webserver know that you are done entering directives.

If you are going to be querying frequently, you may want to add the "Connection: Keep-Alive" directive also, so that you maintain your session between requests.

A few minutes with Wireshark on your regular computer and you should be able to figure the whole thing out.


pansophic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top