The program in my Arduino IDE application cannot connect to the server. Where I use ESP8266. When uploading program code to esp8266, the program always works on the If (!client.connect(host,80)) section. Below is a link to the program code that I mean. Hope someone can help me.
Link
Are you sure you’re in the same network as the ESP8266 tries to connect to and the IP is correct? Try using the HTTPClient object direct without doing a connect on the WiFiClient first, like the Arduino/BasicHttpClient.ino at master · esp8266/Arduino · GitHub does too.
My laptop as a local server and esp is already connected to the same network, maxgerhardt . I’m confused about using the program code that you share “Arduino/BasicHttpClient.ino on master · esp8266/Arduino · GitHub”. What do I try the program code for?
hello maxgerhardt, until now my program code still failed to connect to the server. Previously I’ve updated my code. I have changed my code according to the program code you typed. The following link contains the program code and screenshot of my serial monitor. Previously, if anyone was confused in the comments section of the program code, I used Indonesian and English in the program code. I’m using Arduino IDE, Xampp, and sublime text applications. Thank you so much.
Well it seems you don’t know about curl. It’s a command line tool for executing web queries, to test if your server returns at least 200 OK for the request. How did you test your PHP script?
You can download curl.exe from curl for Windows and use that in the commandline.
I tested my program code in a way when I created the program code, then with the help of the XAMPP web server. I can do PHP testing in the browser. Sorry, I can’t open curl.exe, even though I’ve clicked it many times
It’s not a GUI program, you need to open a cmd.exe then cd <folder where you downloaded it> and then curl -v http://192.168.43.225/bisa/kirimdata.php?sensor=1.0. What does that return?
sorry, I’ve fixed it. That’s because of the impact when I try to redo my code from scratch. And I’ve uploaded the program to the ESP8266 but the connection still fails to the server