Unfortunately, for the time being, there's no PC that I can test on right now.
6v6gt:
As for the alternate fail/success issue
- comment out the two client.stop() statements in your latest code.
- add a new client.stop() statement as the first statement at the beginning of the loop()
To see if that clears the issue.
I tried this, and it works. The connection is all ok. But I still get 400 Bad Request. I google-ed this issue, and found that I need to clear the cache and cookies in my browser. So I did, and it didn't print 400 Bad Request anymore. But, that is just for a while (like first and second test), and then 400 Bad Request appear again.
6v6gt:
The following is a better template to use where you are making repeated http get calls:https://www.arduino.cc/en/Tutorial/WebClientRepeating . Maybe use the structure there.
I run this WebClientRepeating code. It gives me this:
My IP address: 192.168.0.127
connecting...
HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Date: Sat, 05 May 2018 07:56:10 GMT
Location: https://www.arduino.cc/latest.txt
Server: nginx/1.4.2
Content-Length: 184
Connection: Close
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.2</center>
</body>
</html>
6v6gt:
You've said you can see the web server log files. What do you see for the last time you ran your script ? Do you see the full URL your script sent ? If so, post it ?
So this is my access.log file:
192.168.0.127 - - [05/May/2018:15:41:55 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
192.168.0.127 - - [05/May/2018:15:41:59 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
192.168.0.127 - - [05/May/2018:15:42:03 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
192.168.0.127 - - [05/May/2018:15:42:07 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
192.168.0.127 - - [05/May/2018:15:55:11 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
192.168.0.127 - - [05/May/2018:15:55:15 +0800] "GET /arduino/getdata.php?sensor1=1&sensor2=1&sensor3=1 HTTP/1.1Host:" 400 311
What does 400 311 behind it mean?