logo elektroda
logo elektroda
X
logo elektroda

ESP8266 Arduino: Failed to read.txt file from server - 5 years ago it worked

klon111 1461 23
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18620105
    klon111
    Level 11  
    There is an error somewhere as I can't download data from the server.
    It used to be ok before 5 years ago.
    Please take a look.



    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #2 18620508
    khoam
    Level 42  
    klon111 wrote:
    It used to be ok before 5 years ago
    .
    Years ago they still connected via port 80, but these days usually after https :) .
  • #3 18620526
    klon111
    Level 11  
    and how to do it
  • Helpful post
    #6 18620563
    khoam
    Level 42  
    Modify the program to connect securely on port 443. I have verified that https://klonikele.000webhostapp.com/ has a valid certificate. An example you can use:
    https://github.com/esp8266/Arduino/blob/maste...66WiFi/examples/HTTPSRequest/HTTPSRequest.ino

    Fingerprint for https://klonikele.000webhostapp.com/ is: 5B FB D1 D4 49 D3 0F A9 C6 40 03 34 BA E0 24 05 AA D2 E2 01
  • #7 18620616
    klon111
    Level 11  
    is ok thanks

    read online

    20:20:27.971 -> WiFi connected
    20:20:27.971 -> IP address:
    20:20:27.971 -> 192.168.2.2
    20:20:27.971 -> connecting to klonikele.000webhostapp.com
    20:20:27.971 -> Using fingerprint '5B FB D1 D4 49 D3 0F A9 C6 40 03 34 BA E0 24 05 AA D2 E2 01'
    20:20:29.499 -> requesting URL: /StanESP8266.txt
    20:20:29.669 -> request sent
    20:20:29.669 -> headers received
    20:20:44.673 -> esp8266/Arduino CI has failed
    20:20:44.673 -> reply was:
    20:20:44.673 -> ==========
    20:20:44.673 -> zzzza1a2a3a4a5a6a7a8a9 b1b2b3b4b5b6b7b8a9 c1c2c3c4c5c6c7c8c9 d1d2d3d4d5d6d7d8d9 .
    20:20:44.707 -> ==========
    20:20:44.707 -> closing connection
  • #8 18623589
    klon111
    Level 11  
    I have another problem whether on
    Raspberry system OSMC installed PHP Version 7.0.33-0+deb9u6
    It is possible to read and write text via ESP
  • ADVERTISEMENT
  • #11 18626390
    khoam
    Level 42  
    klon111 wrote:
    I cannot see from http://localhost/
    .
    But localhost it will only be seen on localhost as localhost :) .
  • #13 18627576
    khoam
    Level 42  
    Perhaps show what this code looks like in the ESP from which you are invoking PHP on the server.
  • #14 18628603
    klon111
    Level 11  
    ESP has saved 4 times and still does not want to
    from the browser is ok http://192.168.2.6/piwo.php?temp1=29,99
    and after throwing Serial.begin(115200);
    and changing the led pin from 4 to 1 it works fine


    on it does not save
    Code: C / C++
    Log in, to see the code



    this one is ok
    Code: C / C++
    Log in, to see the code
  • ADVERTISEMENT
  • Helpful post
    #15 18629325
    Slawek K.
    Level 35  
    Try this :

    Code: C / C++
    Log in, to see the code


    Greetings
  • #16 18629928
    klon111
    Level 11  
    Works fine thanks , very clear code
    And how to read a.txt file into esp8266

    I browse through the library and cannot find

    Best regards and good health
  • #17 18629937
    Slawek K.
    Level 35  
    This.txt file is where ?
  • ADVERTISEMENT
  • #18 18629944
    klon111
    Level 11  
    yes alone on Raspberry OSMC system
  • #19 18630028
    Slawek K.
    Level 35  
    Write down exactly in turn what you need to do with this file so that I understand the idea.

    Greetings
  • #20 18630056
    klon111
    Level 11  
    The file can be found on the Raspberry http://192.168.2.6/var/www/html/odczyt.txt

    with content e.g. zzzza1a2a3a4a5a6a7a8a9 b1b2b3b4b5b6b7b8a9 c1c2c3c4c5c6c7c8c9 d1d2d3d4d5d6d7d8d9

    The point is to read this text after the analysis is controlled by ESP
  • #22 18630123
    klon111
    Level 11  
    It does not find the file and responds

    13:37:42.269 -> [SETUP] WAIT 4...
    13:37:43.289 -> [SETUP] WAIT 3...
    13:37:44.275 -> [SETUP] WAIT 2...
    13:37:45.295 -> [SETUP] WAIT 1...
    13:37:46.281 -> [HTTP] begin...
    13:37:46.281 -> [HTTP} Unable to connect
    13:37:56.272 -> [HTTP] begin...
    13:37:56.272 -> [HTTP} Unable to connect

    Code: C / C++
    Log in, to see the code
  • #23 18630293
    Slawek K.
    Level 35  
    I think the port number is missing in http.begin()

    Greetings
  • #24 18630400
    klon111
    Level 11  
    is ok works fine
    I want to thank khoam and Slawek K. for help
    From these programs you can control ESP8266 with Raspbery-OSMC with PHP installed and with servers

    Code: C / C++
    Log in, to see the code
    .

Topic summary

The discussion revolves around issues faced while attempting to read a .txt file from a server using the ESP8266 module, which previously functioned correctly five years ago. Users noted that modern connections often require HTTPS instead of HTTP, prompting suggestions to modify the code to connect securely on port 443. A specific server, "klonikele.000webhostapp.com," was mentioned as having a valid SSL certificate. Various code snippets were shared to demonstrate how to establish a connection and retrieve data from the server. Users also discussed challenges related to PHP integration on a Raspberry Pi system and provided examples of successful code implementations for reading and writing data.
Summary generated by the language model.
ADVERTISEMENT