Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PWS Weather.com
Author | Message | ||||
MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
WPSweather.com has a new web site where home weather stations can post their weather data. Here is the Annex code portion to achieve this. See my web site 'now send YARRAGONAU via HTTP @ PWSweather.com d$="20"+DATE$(2) d$=replace$(d$,"/","-") pws1$="dateutc="+d$+"%20"+time$+"&ID=YARRAGONAU&PASSWORD="your_password=updateraw" pws2$=pws1$+"&tempf="+otf$+"&humidity="+oh$+"&dewptf="+dpf$ pws2$=pws2$+"&windspeedmph="+wsm$+"&windgustmph="+wgm$+"&winddir="+wd$+"&baromin="+pri$ pws2$=pws2$+"&dailyrainin="+rai$ pws2$="www.pwsweather.com/pwsupdate/pwsupdate.php?"+pws2$ 'wlog pws2$ WGETASYNC(pws2$, 80) pause 300 I have also written a REST API to upload live data (eg from annex) to a website page , an example is the Garden Solar page on my website <?php /* REST Get request API interface to update a json file updatefile.php usage: url/updatefile-xx.php?key="your_api_key"&file="filename"&json="json string" codenquilts.com.au */ $rpath="data/"; //$apikey="your_api_key"; $apikey="your_api_key"; //grab the values sent in the GET request, API Key Filename and JSON string $key=$_GET['key']; $file=$_GET['file']; $json=$_GET['json']; //echo ("$key"); //example json string //json={"Peter":35,"Ben":37,"Joe":43} //echo ("$json"); //echo ("$rpath" . "$file" . ".json"); if ($apikey == $key){ $result=file_put_contents($rpath . $file . ".json", $json); //echo ($result); if ($result >= 1){ echo ("ok"); } else { //e2: failed db write echo ("e2");} } else { //e1: failed api key echo ("e1"); } //close the connection mysqli_close($link); ?> Mike Hope you are all OK, Stay Safe, Stay Home if you can. Codenquilts |
||||
Print this page |