I'm sending data to a webserver, and the webserver stores in mysql database. How i return back the stuff (ok) variable to arduino and make a Serial Print(#stuff)?
String request = "GET "+ repository + "sensor.php?value=" + value + " HTTP/1.0";
send_request(request);
void send_request (String request) {
Adafruit_CC3000_Client client = cc3000.connectTCP(ip, port);
if (client.connected()) {
client.println(request);
client.println(F(""));
Serial.println("Connected & Data sent");
}
else {
Serial.println(F("Connection failed"));
}
string buffer;
int counter = 0;
while (client.connected()) {
while (client.available()) {
buffer[counter++] = client.read();
}
}
Serial.println("Closing connection");
Serial.println("Buffer value is: " + buffer);
client.close();
}
PHP FILE:
$stuff = "";
include("conec.php");
if ($_GET["value"]) {
$link=Conection();
$Sql="insert into table (VALUE) values ('".($_GET["value"])."')";
mysql_query($Sql,$link);
$stuff = "ok";
}