Open sbecerikli opened 3 years ago
then there is a gap in received data, available() returns 0 and you stop read
I am not returning any data from php file. just echo what I get from url in php
Here is my php file
if( $_GET["esp_value"] ) {
$myfile = fopen("newfile.txt", "a") or die("Unable to open file!");
fwrite($myfile, $_GET["esp_value"]);
echo $_GET["esp_value"];
fclose($myfile);
}
Also here httpsrequest function
void httpRequest() { Serial.println();
// close any connection before send a new request // this will free the socket on the WiFi shield client.stop();
// if there's a successful connection if (client.connect(server, 80)) { Serial.println("Connecting...");
// send the HTTP PUT request
randNumber = random(300);
req = "GET /esp/esp.php?esp_value=";
req2 = " HTTP/1.1";
String request = req + randNumber + req2;
Serial.println("reuqest: " + request);
client.println(request);
client.println(F("Host: seyfullahbecerikli.com"));
client.println("Connection: close");
client.println();
// note the time that the connection was made
lastConnectionTime = millis();
} else { // if you couldn't make a connection Serial.println("Connection failed"); } }
read my comment again
Hello,
Firstly thans for your library., I need to get data from a web server. How can I do that?
When request "client.println(F("GET /esp.php/?esp_value=61 HTTP/1.1"));" and print this while (client.available()) { char c = client.read(); Serial.write(c); }
It just print HTTP/1.1 200 OK Connection: close X-Powered-By: PHP/7.4.11 Content-Type: text/html; charset=UTF-8 Content-Length: 2