Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

381
Vistas
ESP8266httpEmisión de actualización Servidor PHP

Bueno,

Estoy usando la biblioteca ESP8266httpUpdate con el ejemplo de php para comunicarme con el servidor y si el archivo .bin tiene un md5 diferente, instale el nuevo .bin.

No consigo que funcione, en arduino el monitor serial me sale:

 I get HTTP_UPDATE_FAILD Error (-104): Wrong HTTP Code 13: 04: 55.613 -> CALLBACK: HTTP update fatal error code -104

Este es mi código PHP:

 <?PHP header('Content-type: text/plain; charset=utf8', true); function check_header($name, $value = false) { if(!isset($_SERVER[$name])) { return false; } if($value && $_SERVER[$name] != $value) { return false; } return true; } function sendFile($path) { header($_SERVER["SERVER_PROTOCOL"].' 200 OK', true, 200); header('Content-Type: application/octet-stream', true); header('Content-Disposition: attachment; filename='.basename($path)); header('Content-Length: '.filesize($path), true); header('x-MD5: '.md5_file($path), true); readfile($path); } if( !check_header('HTTP_X_ESP8266_STA_MAC') || !check_header('HTTP_X_ESP8266_AP_MAC') || !check_header('HTTP_X_ESP8266_FREE_SPACE') || !check_header('HTTP_X_ESP8266_SKETCH_SIZE') || !check_header('HTTP_X_ESP8266_SKETCH_MD5') || !check_header('HTTP_X_ESP8266_CHIP_SIZE') || !check_header('HTTP_X_ESP8266_SDK_VERSION') ) { header($_SERVER["SERVER_PROTOCOL"].' 403 Forbidden', true, 403); echo "only for ESP8266 updater! (header)\n"; exit(); } $localBinary = "/var/www/vhosts/domain.com/httpdocs/folder/arduino.bin"; // Check if version has been set and does not match, if not, check if // MD5 hash between local binary and ESP8266 binary do not match if not. // then no update has been found. if(($_SERVER["HTTP_X_ESP8266_SKETCH_MD5"] != md5_file($localBinary)) { sendFile($localBinary) } else { header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified', true, 304); }

Tal vez el problema esté en la ruta del archivo .bin localBinary, pero no sé cómo resolverlo.

Muchas gracias

EDITAR: archivo acces_log:

 [`14/Aug/2021:13:16:14 +0200] "GET /folder/arduino_check_updates.php HTTP/1.0" 500 177 "-" "ESP8266-http-Update"`
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda