logo elektroda
logo elektroda
X
logo elektroda

ESP8266 AT Commands GET Request Returns 400 Bad Request on Local Apache PHP Server

JakubST 2862 2
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16325833
    JakubST
    Level 10  
    I am using an ESP8266 module with the current ESP8266_NONOS_SDK_V2.0.0_16_08_10 firmware.
    I am making GET requests via AT commands to PHP+MySQL servers.

    Web servers - ESP8266 works fine .
    Here everything works ok.

    Whether I call the url in the browser: http://zzzzzzz.zzzzzzzzz.zz/dodaj_rek.php?n=129&u=1488723073&d=-51&s=203
    or with AT commands in the ESP8266 module:
    Code: Bash
    Log in, to see the code
    .
    the server responds correctly:
    Code: Bash
    Log in, to see the code
    .
    and the data lands in a database on a server somewhere in Poland.


    Server on local network - ESP8266 problem .

    I have installed Apache + MySQL + PHP server on a computer with IP address 192.168.1.51 listening on port 80.

    Typing the address 192.168.1.51 correctly runs the index.php script.

    Calling the url in your browser:
    http://192.168.1.51/dodaj_rek.php?n=129&u=1488723073&d=-51&s=203
    or
    192.168.1.51/dodaj_rek.php?n=129&u=1488723073&d=-51&s=203
    correctly runs php script and adds record to database.

    The server is seen by other computers, tablets or smartphones on the network by which the use of in a browser the above url correctly works regardless of whether the device is connected via LAN or WiFi.


    The problem occurs when I want to do the same thing using the ESP8266 pointing to the IP address of a server on the local network:

    Code: Bash
    Log in, to see the code
    .
    CIPSTART responds, correctly connecting to the server
    CIPSSEND also responds correctly with a prompt > and the ESP8266 waits for a GET to be sent.

    After the GET is sent, it correctly reports that the correct number (81) of bytes have been received:
    Code: Bash
    Log in, to see the code
    .
    but generates a 400 Bad Request error:
    Code: Bash
    Log in, to see the code
    .

    I attach the Apache and PHP configuration files.

    I've spent hours on this, searched the web for information, but found nothing that solves the problem or at least gives the cause.

    I even tried specifying the port number in GET additionally by sending 84 characters:
    Code: Bash
    Log in, to see the code
    .
    but the effect is the same - connection ok, confirmation of receiving the correct number of GET bytes also ok, but unfortunately again error 400 Bad Request.
  • ADVERTISEMENT
  • #2 16328463
    dondu
    VIP Meritorious for electroda.pl
    The GET should look as follows:

    Code: Bash
    Log in, to see the code
  • #3 16330409
    krzbor
    Level 28  
    Try inserting "/add_rek.php" instead of "add_rek.php" i.e. add a slash:
    GET /dodaj_rek.php ....
    If this doesn't help, change the HTTP from 1.1 to 1.0
ADVERTISEMENT