Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By gerardwr
#46615
Ayush Sharma wrote:I don't understand.. Help would be really Appreciated! :)


As @martinayotte advise start with the BasicHttpClient.

I suggest you try connecting to a know server to see how it works. See below for connecting to http://www.google.nl

I changed line 34 for my router credentials:
Code: Select all WiFiMulti.addAP("myroutername", "myrouterpassword");


I changed line 47 to:
Code: Select allhttp.begin("http://www.google.nl/index.html"); //HTTP


When running the sketch you should see this response from http://www.google.nl in the Arduino Serial Monitor:
Code: Select all[HTTP] begin...
[HTTP] GET...
[HTTP] GET... code: 200
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="nl"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script>(function(){window.google=
<rest of response snipped>


Good luck!.
User avatar
By drekthral
#46619
martinayotte wrote:Yes, since you seems to use ESP8266HTTPClient, it should work !
Did you started with esp8266/2.2.0/libraries/ESP8266HTTPClient/examples/BasicHttpClient/BasicHttpClient.ino example ?

Thanks for response.

This code works fine:
Code: Select allhttp.begin("http://192.168.10.1/test/esp8266.php?temp=temperatureFromSensor);

But I want something like this:
Code: Select allhttp.begin("http://192.168.10.1/test/esp8266.php?temp=", temp);

And this code return error in serial monitor: [HTTP] GET... failed, error: connection refused

Any ideas ?
User avatar
By martinayotte
#46637 If "temp=" has no value, probably your PHP script get into trouble somehow and never provide response.
Try to do the same with a browser, and if it is hang, you need to narrow the issue in this PHP script and/or HTTP server, there are probably hints in the logs of that server.