Go Down

Topic: GET - http request not working? (Read 1 time) previous topic - next topic



i would like to send some temperature values to my home server. To send new values the server expects the following format:


"ise_id=" is the ID of the variable and "new_value=" is the value - nothing special so far.
the code look like this (i enter a fixed value 1005 just for testing).

Code: [Select]
client.print("GET HTTP/1.0");

Sending the values through webbrowser is working perfect. If the code is send from Arduino it cut's off everything behind the ID. So the Arduino is sending the following request only:
"/config/xmlapi/statechange.cgi?ise_id=15324"  -  &new_value=...  is completely missing in the request! I don't know why. If i change the & character with any other it sends the complete request, only the & is not working. What's going on here? Do i miss something?

Any help is much appreciated.



How have you verified that the request is being cut? Did you check the server logs or did you use a network monitor/sniffer?

Anyway,  GET request you are trying to send looks invalid. Check this thread: http://arduino.cc/forum/index.php/topic,113010.msg851718.html#msg851718

Especially the post where I explain how you can test the request using telnet.  Testing with a browser is not the same thing.


Show us the whole code. Your request is wrong in any way but only if we see the rest of your code we can give you advise how to correct it.


below is the complete code. I have made a new sketch with the air pressure value only - just to keep it simple. It's still not working.
I get the correct reading / values at the serial interface - only the GET request is not working.

How have you verified that the request is being cut? Did you check the server logs or did you use a network monitor/sniffer?

if you have this complete line in the code, it becomes a hyperlink and opens at the webbrowser but everything was cut off behind & - see my first post.
client.print("GET HTTP/1.0");

Is there any way to monitor the GET Request in order to see what the arduino is send to the server?

Code: [Select]
#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>
#include <BMP085.h>

// I2C
BMP085 dps = BMP085();      // Digital Pressure Sensor
long Temperature = 0, Pressure = 0, Altitude = 58800;

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x2D, 0xF9 };
IPAddress server(192,168,178,21);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
// Open serial communications and wait for port to open:
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
  // give the Ethernet shield a second to initialize:

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
  else {
    Serial.println("connection failed");

// start I2C für BMP085
  dps.init(MODE_ULTRA_HIGHRES, 58800, true);  // 588 meters, true = using meter units

void loop()
  // Get Altitude and air pressure

  Serial.print("  Alt(cm):");
  Serial.print("  Pressure(mbar):");
  Pressure = Pressure / 100;
  client.print("GET /config/xmlapi/statechange.cgi?ise_id=15324&new_value=");



What goes in the GET request, and what you type in a browser window, are not the same thing.

The GET request implies an http protocol, so that does not belong in the request string. You have already connected to the server, so the server IP does not belong in the string.

Go Up