WiFi module as client accessing url
Capdiamont
Posts: 218
in Accessories
I have the module setup and serving weather data on a webpage. I would like to have the WiFi module act like a client and access a webpage on the internet. Reading though the documents, the only connection that acts like a client is TCP. Can I simply put in a url I want to access in the tcp connection and it will work or do I need to break up the connection in to steps? I need to be able to change the url frequently.
Comments
I have a project here that connected to a weather service.
I also have a weather station on my roof that sends UDP packets to my webserver on my network so I can see weather data on my website here.
One uses a XBEE unit and the other a ESP8266 module. Both are connected to my WiFi network.
Mike
Using the Parallax ESP module you need to do these things.
send a connect event for the URL:
send a GET request with your weather keys
receive the data back from there service
close the connection
I see you are using the weather underground. Looking at there site it looks like that service is no longer available. I am using open weather for my data and you can also use AccuWeather as well.
First send CMD CONNECT "api.openweathermap.org" , 80
Next send CMD SEND "GET /data/2.5/weather?yourweatherkeyanddata
Also you need to end that request with " HTTP/1.1" and some other data but should not be necessary.
You need to end that request with two CR/LF codes to tell the site your finished sending your request.
Then send CMD RECV handle size to get your data back
Finally send CMD CLOSE handle
Mike
https://github.com/parallaxinc/Parallax-Wi-Fi-Apps/blob/master/Firmware-Package-Subfolders/Examples/Propeller%20C/Temperature%20from%20OpenWeatherMap.c
dgately
Looking at the code, yes, it is total of four characters.
If I don't want data back, do I need to scan?
I need to host a webpage on the prop to turn on devices connected