Go Down

Topic: Posting to Weatherunderground (wunderground) via PHP (Read 1 time) previous topic - next topic


Hello All,

I have been trying to establish some building blocks for my weather station. I have a nuelectronics style Ethernet card. I actually got it from ekitszone, but I believe it is the same as all the code example etc work from nuelectronics.

I am using the libraries from http://openenergymonitor.org/emon/node/80.

I have managed to get a pachube feed to update, but am struggling with getting wunderground to update.

The address to update via is in this format.


I have tested the url in the code, it works fine. I have also tried GET, POST & PUT. I have also tried with and without the IP in the URL.

My code is below, would someone mind telling me where I am going wrong? Please!
Code: [Select]

#include "etherShield.h"
#include "NUClient.h"


#define WU_STATION_ID              "IESUSSEX2"     
#define WU_PASSWORD                "******"

byte mac[] = { 0x54,0x55,0x58,0x10,0x00,0x26 };
byte ip[] = { 192, 168, 1, 15 };
byte gateway[] = { 192, 168, 1, 1 };
byte server[] = {  38, 102, 136, 104  }; //wunderground.com , 125
int port = 80;

//Create a client
NUClient client(mac,ip,gateway,server,port);

int content_length;

void setup () {
  //Useful for debugging
  //Serial.print outputs of what the client is doing.
  //If your having trouble with timeouts
  //try different timeout times it may sort it.

void loop()
  //Do things that need to be done even when
  //the ethernet shield is connecting etc here.
  //If the client has finished sending.
  if (client.done)
    //Increment values so that we can see something happening!
   // valA += 1.2;

    //Do things that only need to be done when
    //the client has done sending.
    //Tell the client that it is not done and it needs to start sending again.
  //client.process opens and closes the client connection
  //It returns a one when the connection is at the data
  //sending stage.
  //client process will also check for pings

    Serial.println("data process");
   //If your using a shared server you may need to include  http://yourwebsite.org
     //as below. If your server has a static ip its not needed.
     client.print("PUT******&dateutc=2011-03-14 19:05:00&tempf=55&softwaretype=Arduino&action=updateraw");
     client.print(" HTTP/1.0\r\n");
    Serial.println("data sent");

Many Thanks



Typically, the end of client data is indicated by outputting a blank line, using client.println(). You don't output any blank lines. Also, each type of data is output with a carriage return/linefeed following it (as done by println()).



I'm interested in sending data to Weather Underground.  Did you ever get your code to work?

Go Up