0

we are stuck on this problem where the arduino won't send data to server when i use string concatenation. It works when we used localhost as our server but when we use a real server, it does not work anymore. We need to send the DO value to our server.

// This does not work

String data = "GET /dissolved/insertdata.php?dissolvedoxygen=" + String(disoxx) + "&temperature=" + floatToString(temp,2);

client.println(data);

//This work String data="GET /dissolved/insertdata.php?dissolvedoxygen=6.233&temperature=23.60" ;

client.println(data);

iamkristher
  • 408
  • 1
  • 5
  • 19
  • What kind of error are you getting? Compiler error, runtime error from server, nothing being sent? You might try outputting data on the serial port to verify what you think you are sending. It's a bit surprising that you are using floatToString on the temp, but not on disoxx. – walrii Jun 20 '13 at 00:52
  • disoxx is already a string, forgot to remove String(). there is no error, it just doesn't update my database with customize string unlike in constant strings. Now it does not work even in localhost. I don't know what's the problem. – iamkristher Jun 20 '13 at 02:08
  • Have you verified the contents or data by writing it out to the serial port or some other mechanism? Can you run wireshark on the server to look at the actual packets? – walrii Jun 20 '13 at 19:21
  • You can't concat strings the way you did it. Check this: http://stackoverflow.com/questions/308695/how-to-concatenate-const-literal-strings-in-c – Moonjsit Jun 23 '15 at 13:14

1 Answers1

1

You need two terminators on the request. Add another \r\n.

everyone forgets these

Community
  • 1
  • 1
jdr5ca
  • 2,809
  • 14
  • 25