Skip navigation

community

225 Views 9 Replies Latest reply: Feb 10, 2012 1:00 PM by dakota77 RSS
Currently Being Moderated

Feb 8, 2012 2:51 PM

Upload a parameter to a web page

Hello,

 

My project is to use the Arduino as a datalogger (for temperature and gas consumption).

The temperature measurement and gas counter work fine.

I would like now to transmit these data to a web page.

 

The web page is ready to receive the data : this is the url used with my web brower to transmit data :

http://www.xx/NS1.php?P1=counter_value

When the parameter is received, the web page sends an email.

 

Now I would like to do the same thing with the arduino.

But it doesn’t work : there is no error message but the web page is simply not activated. This is the code used :

 

#include <SPI.h>

#include <Ethernet.h>

 

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server(xx,xx,xx,xx); //my web site IP adress

EthernetClient client;

 

void setup() {

  delay(3000);

  Serial.begin(9600);

  Serial.println("Starting...");

  if (Ethernet.begin(mac) == 0) {

     Serial.println("Failed to configure Ethernet using DHCP");

  }

 

  delay(1000);

  Serial.println("connecting...");

 

  if (client.connect(server, 80)) {

      Serial.println("connected");

      client.println("http://www.xxx.NS1.php?P1=counter_value");

      client.println();

      Serial.println("Request sent");

  }

  else {

      Serial.println("connection failed");

  }

}

 

void loop()

{

}

 

Do you have an idea of what is wrong ?

Thanks for your help.

Attributes

Related Content


Related Products
Discussions
  • Retrieving data ...

Bookmarked By (0)