小编Bro*_*mid的帖子

错误:调用使用属性声明的“HTTPClient::begin”错误:过时的 API,使用 ::begin(WiFiClient, url)

我尝试用 esp8266 做一个时钟新闻天气滚动字幕。但是当我上传代码时出现错误。你能帮助我吗?这是代码的一部分:(根据 MIT 许可证(版权所有 2018 David Payne))

  void PiHoleClient::getPiHoleData(String server, int port) {

  errorMessage = "";
  String response = "";

  String apiGetData = "http://" + server + ":" + String(port) + "/admin/api.php?summary";
  Serial.println("Sending: " + apiGetData);
  HTTPClient http;  //Object of class HTTPClient
  http.begin(apiGetData);// get the result (**the error code**)
  int httpCode = http.GET();
  //Check the returning code
  if (httpCode > 0) {
    response = http.getString();
    http.end();   //Close connection
    if (httpCode != 200) {
      // Bad Response Code
      errorMessage = …
Run Code Online (Sandbox Code Playgroud)

httpclient arduino-esp8266

6
推荐指数
1
解决办法
5万
查看次数

标签 统计

arduino-esp8266 ×1

httpclient ×1