当前位置: 代码迷 >> 综合 >> http请求心知天气400 The plain HTTP request was sent to HTTPS port解决方案
  详细解决方案

http请求心知天气400 The plain HTTP request was sent to HTTPS port解决方案

热度:90   发布时间:2024-02-10 09:42:24.0

问题说明

在调用http.begin(client, "https://api.seniverse.com/v3/weather/now.json?key=your_private_key&location=beijing&language=zh-Hans&unit=c")函数时报错

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>

解决方案

调用http.begin(client, host, 80, urlDate);
如下

String urlDate = "/v3/weather/daily.json?key="+my_private_key+"&location="+City+"&language=zh-Hans&unit=c";
http.begin(client, "api.seniverse.com",80,urlDate);
  相关解决方案