esp8266获取网页源码 串口输出出错 求助!!
--------------- CUT HERE FOR EXCEPTION DECODER ---------------0!⸮⸮d⸮)
⸮
总空间: 1953282 Bytes
已用空间: 0 Bytes
Connecting
......
Connected to 20pro
IP address: 192.168.43.152
600s.com
Using fingerprint '546ad71159d92c63fafa00705a7cb69f166d3ef9'
HTTPS Connecting
Connected...
requesting: 600s.com
request sent
headers received
==========
server response payload:
1b67
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>口令 | 简单快速 轻松同步 -- 600s.com</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="date=no">
<meta name="format-detection" content="address=no">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/static/img/icon-57.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/icon-72.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/icon-114.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/icon-144.png">
<meta name="apple-mobile-web-app-title" content="口令">
<link rel="shortcut icon" href="/static/img/favicon.png">
<link rel="stylesheet" type="text/css" href="/static/css/style.css?v=1" />
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.lightbox_me.js"></script>
<script type="text/javascript" src="/static/js/jquery.form.js"></script>
<script type="text/javascript" src="/static/js/script.js?v=1"></script>
<script type="text/javascript" src="/static/js/clipboard.min.js"></script>
<style>
</style>
<script type='text/javascript'>
$(document).ready(function() {
var t = new Date("2021-05-13T13:43:21.656025");
var now = new Date().getTime();
var sec = Math.ceil((t - now) / 1000);
if (sec > 1){
window.setInterval(setTimeView, 1000);
}
function setTimeView() {
if (sec > 0) {
var second = Math.floor(sec % 60);
var minite = Math.floor((sec / 60) % 60);
var hour = Math.floor((sec / 3600) % 24);
var day = Math.floor((sec / 3600) / 24);
var minite_view = "<span id='id_minite'>"+ minite + "分钟"+"</span>";
var hour_view = "<span id='id_hour'>"+ hour + "小时"+"</span>";
var day_view = "<span id='id_day'>"+ day + "天"+"</span>";
if(minite === 0) {
minite
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Soft WDT reset
>>>stack>>>
ctx: cont
sp: 3ffffc50 end: 3fffffc0 offset: 01a0
3ffffdf0:00000000 00000000 4bc6a7f0 00000000
3ffffe00:3fff87a8 00000000 69765f65 402079ed
3ffffe10:3fff759a 00000000 00000001 40100154
3ffffe20:002f558a 3ffffe70 3ffffe70 0000001e
3ffffe30:00000031 3ffe86b2 3ffee608 40204f34
3ffffe40:00000031 3ffffe70 3fffff3c 40205381
3ffffe50:00000031 3ffe86b2 3ffee608 402053dd
3ffffe60:3ffe8674 3ffe86b2 3ffee608 402011f3
3ffffe70:4020f9c0 00000000 00001388 00001568
3ffffe80:00000000 3ffefe9c 3fff1b2c 3ffeffdc
3ffffe90:00000000 00000000 3fff1b2c 00000000
3ffffea0:00000000 00000000 00000000 00000000
3ffffeb0:00000000 3fff2884 3ffefeec 3fff69d4
3ffffec0:3ffeff04 00000000 00000000 00000000
3ffffed0:00004145 00000255 3fff0001 00000000
3ffffee0:00000000 00000000 00000000 00000000
3ffffef0:00000000 00000000 6a540100 d95911d7
3fffff00:fafa632c 7c5a7000 6d169fb6 4000f93e
3fffff10:00000000 00000003 00000000 00000000
3fffff20:3ffe8700 00000000 00000000 3ffe86e9
3fffff30:00000000 3ffee608 3ffe8674 00000000
3fffff40:00000000 80004f44 3fff6c34 1b741b7f
3fffff50:00fe006c 3fff00a4 0039003f 002053c0
3fffff60:982ba8c0 00ffffff 012ba8c0 3ffe86e9
3fffff70:3ffe8751 3ffee5d0 3ffee608 40201382
3fffff80:4020fb20 982ba8c0 feefeffe feefeffe
3fffff90:feefeffe feefeffe feefeffe 3ffee690
3fffffa0:3fffdad0 00000000 3ffee650 40205edc
3fffffb0:feefeffe feefeffe 3ffe84e8 40100b85
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
以上是出现的错误信息代码获取不到一半就错误了一直重复
下面是 程序代码
这是在太极创客网站复制的代码第一次修改获取的网站后上传可以获取成功,后来修改了一下其他代码就开始出错了。 现在我有直接复制他的代码改了一下获取网站其他什么页没动 还是是获取不了 。
请高手帮帮忙是不是硬件坏了???
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <FS.h>
//WiFi连接信息(注意:需要自行修改以下内容否则ESP8266无法连接WiFi)
#define ssid "sd20pro" //WiFi名称
#define password "17s470qaw5"//WiFi密码
FSInfo fs_info;
//测试HTTPS通讯的网站
const char *host = "600s.com";
//HTTPS端口443
const int httpsPort = 443;
//注意:出于安全原因,网站服务器会定期更新证书指纹信息。因此本程序
//中的证书指纹可能已经过期。请使用浏览器获取最新的服务器证书指纹
//并复制粘贴到此处。如需了解如何执行这一操作,请参考太极创客网站中
//“获取网站证书指纹”页面(网址见下):
//http://www.taichi-maker.com/homepage/iot-development/iot-dev-reference/esp8266-c-plus-plus-reference/http-client-secure/certificate-fingerprint/
const char fingerprint[] PROGMEM = "546ad71159d92c63fafa00705a7cb69f166d3ef9";;
void setup() {
//SPIFFS.format();
Serial.begin(9600);
WiFi.mode(WIFI_STA); //设置ESP8266为无线终端工作模式
SPIFFS.begin();
WiFi.begin(ssid, password); //连接WiFi
Serial.println("");
SPIFFS.info(fs_info);
// 可用空间总和(单位:字节)
Serial.print("总空间: ");
Serial.print(fs_info.totalBytes);
Serial.println(" Bytes");
// 已用空间(单位:字节)
Serial.print("已用空间: ");
Serial.print(fs_info.usedBytes);
Serial.println(" Bytes");
Serial.println("Connecting"); Serial.println("");
// 等待连接
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
//成功连接后通过串口监视器显示WiFi名称以及ESP8266的IP地址。
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// 实现HTTPS通讯
httpsCom();
}
void loop() {}
void httpsCom() {
WiFiClientSecure httpsClient; //建立WiFiClientSecure对象
Serial.println(host);
Serial.printf("Using fingerprint '%s'\n", fingerprint);
httpsClient.setFingerprint(fingerprint);
httpsClient.setTimeout(15000);
delay(1000);
Serial.println("HTTPS Connecting"); Serial.println("");
int r = 0; // 尝试连接服务器并等待
while ((!httpsClient.connect(host, httpsPort)) && (r < 30)) {
delay(100);
Serial.print(".");
r++;
}
// 连接超时后输出"连接失败"信息并返回
if (r == 30) {
Serial.println("Connection failed");
return;
} else { // 连接成功则输出“连接成功”信息
Serial.println("Connected...");
}
Serial.print("requesting: ");
Serial.println(host);
// 建立HTTPS请求信息字符串
String request =String("GET /bfql") + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n" +
"\r\n";
// 向服务器发送请求
httpsClient.println(request);
Serial.println("request sent");
// 检查服务器响应信息。一旦查到响应头结束字符,则通过串口监视器
// 告知用户当前ESP8266已经成功接收服务器响应头信息。
while (httpsClient.connected()) {
String line = httpsClient.readStringUntil('\n');
if (line == "\r") {
Serial.println("headers received");
break;
}
}
// 通过串口监视器输出服务器响应体信息(服务器报文)
Serial.println("==========");
Serial.println("server response payload:");
String line;
while (httpsClient.available()) {
line = httpsClient.readString();
Serial.println(line);
}
Serial.println("==========");
//操作结束,断开服务器连接
httpsClient.stop();
Serial.println("closing connection");
}
我原本是想把这个网站获取的内容截取其中显示的文本然后,放到esp8266 变量里显示到屏幕上。可是现在一直获取不到。怎么回事??有人帮帮我吗?
请求的网站是https://600s.com 这是一个同频网站 谁有代码参靠一下也好谢谢了 就是获取其中一段文本 到变量里
页:
[1]