1、前两篇文章讲过的将不再赘述
2、方法
不使用ntp服务器,直接GET某个网站;
这里使用GET B站的服务器进行测试;
连接上B站后执行下述程序:
/* 先定义两个变量 */
char *http = "GETn";
char *ipd = NULL;
/* 发送GET请求 */
ESP8266_SendData(http,4);
/* 获取服务器返回的信息 */
ipd = ESP8266_GetIPD(100);
printf("rn%srn",ipd);
这个ipd就指向获取到的数据;
获得的内容如下:
HTTP/1.1 400 Bad Request
Server: Tengine
Date: Mon, 21 Dec 2020 08:39:15 GMT
Content-Type: text/html
Content-Length: 568
Connection: close
400 Bad Request
400 Bad Request
Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
URL: |
http://default.bilibili.com |
Server: |
ks-gz-webcdn-02 |
Date: |
2020/12/21 16:39:15 |
Powered by Tengine
tengine
CLOSED
CLOSED 可以看到倒数第7行就是当前的北京时间。
1、前两篇文章讲过的将不再赘述
2、方法
不使用ntp服务器,直接GET某个网站;
这里使用GET B站的服务器进行测试;
连接上B站后执行下述程序:
/* 先定义两个变量 */
char *http = "GETn";
char *ipd = NULL;
/* 发送GET请求 */
ESP8266_SendData(http,4);
/* 获取服务器返回的信息 */
ipd = ESP8266_GetIPD(100);
printf("rn%srn",ipd);
这个ipd就指向获取到的数据;
获得的内容如下:
HTTP/1.1 400 Bad Request
Server: Tengine
Date: Mon, 21 Dec 2020 08:39:15 GMT
Content-Type: text/html
Content-Length: 568
Connection: close
400 Bad Request
400 Bad Request
Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
URL: |
http://default.bilibili.com |
Server: |
ks-gz-webcdn-02 |
Date: |
2020/12/21 16:39:15 |
Powered by Tengine
tengine
CLOSED
CLOSED 可以看到倒数第7行就是当前的北京时间。
举报