0

Lets Say That I Have a routine like:

Routine

I have written PHP codes for the free domain that will:

  1. Wait for request like url/control?ToDo="someMethod",parm=Something (posting some password for security) and will change the database values for ToDo and parms as the request sayed

  2. Wait for request like url/veiw (posting some password for security) and will send the values of sensors that is stored in the database

  3. Wait for request like url/esp?Doin="someMethod",sens1=Something,sens2= ..... and will change the database values for doin and sensors as the request said

  4. Wait for request like url/check and will send the values of ToDo and parms that is stored in the database

The problem in the code of ESP or node that they need IP to connect the IP that I know is free domain provider's not for my link

I guess I'm missing some knowledge in servers (in english too but it's off the topic XD) and IP things

Any one can help with a well documented method or API?

Edit:

There Were 2 main problems -:

1- I Need to know more about HTTP requests , How they look like and what should be in Headers

2- After I have build a good ones and Tried the problem was in my connection with free domain server I've checked to find out that the server is down so I moved To a reliable Server And , It worked .

I guess that's it for now , Thanks too you All

  • is your problem simply that you have not provided a "gateway" for the esp module? For example you show a "direct link" from the cell phone to the "n.freedomainprovider.com", the cell phone can connect either thru the mobile data network or through a wifi router to the internet. The esp module does not use mobile data, it needs to connect to the internet through some sort of router (just like any other wifi device). – nPn Jun 9 '18 at 14:35
  • If you only use it on a local network, you could use mDNS instead of your freedomain. – Gerben Jun 9 '18 at 17:46
1

You do not need the IP address of the server. You connect with the name of the server and DNS will resolve it to IP address. See the WiFiClient example of the ESP8266WiFi library

| improve this answer | |
  • As a side note: multiple domains are resolved to the same IP address by DNS. So one server with one public IP address can serve thousands of web sites. When you open some website in browser, the server needs to know which website are you referring to, and this is defined in the HTTP request header. So when building your own HTTP GET request, you specify the method (GET), script path, and host name (Host: ...) – gabonator Jun 9 '18 at 9:36
  • that side not was what i'm missing , i'll try putting the host in the request – Abdo Magdy Jun 9 '18 at 12:19
  • hostname goes in the Host header. what is unclear on the WiFiClient example? – Juraj Jun 9 '18 at 12:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.