No matching function for call to 'HttpClient::HttpClient()'

I am trying to connect arduino uno to ifttt server to trigger a philip lightbulb. I done some research
and found out this I followed it advise and
made this code

#include "WiFiEsp.h"
#define USE_JSON_FOR_IFTTT true

#include "HttpClient.h"
#define HTTP_CODE_OK 200  // Good HTTP return code

//#include "MY_IFTTT_CREDENTIALS.h"           

#define MY_IFTTT_KEY    "included"           // from Webhooks doc in IFTTT when you have an IFTTT account
#define MY_IFTTT_APPLET MY_IFTTT_SONOFF_APPLET // from IFTTT Applet which consumes the webhook POST

// Very helpful article on HTTP GET and POST 
// https://randomnerdtutorials.com/esp32-http-get-post-arduino/#http-post

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif

char ssid[] = "xxx";            // your network SSID (name)
char pass[] = "xxx";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void postToIFTTT ( const String& message ) 
{
  Serial.println ( "\npostToIFTTT called with message <" + message + ">" ); 

  // Set up an HTTP client object for the IFTTT POST 
  HttpClient IFTTTpost;  
  
  // Server name URL

  String IFTTTserverName = "https://maker.ifttt.com/trigger/" + String ( MY_IFTTT_APPLET ) + "/with/key/" + String ( MY_IFTTT_KEY );

  long elapsed = millis();  
  
#if ESP32
  IFTTTpost.begin ( IFTTTserverName );  //Specify request destination, open HTTP connecction
#elif ESP8266
  WiFiClientSecure client;
  IFTTTpost.begin ( client, IFTTTserverName );  //Specify request destination, open HTTP connecction
#endif

  Serial.print ( " IFTTT ServerName <" ); Serial.print ( IFTTTserverName ); Serial.println ( ">" ); 

#if USE_JSON_FOR_IFTTT
  IFTTTpost.addHeader ( "Content-Type", "application/json" );

  // IFTTT's JSON payload is { "value1" : "xx", "value2" : "mm", "value3" : "gg" }
  // IFTTTrequest = "{ \"value1\" : \"Yo_Bud\", \"value2\" : \"mm\", \"value3\" : \"gg" }";
  String IFTTTrequest = "{ \"value1\" : \"" + String ( message ) + "\" }"; // spaces permitted !
  Serial.print ( "  JSON POST is    <" ); Serial.print ( IFTTTrequest ); Serial.println ( ">" ); 

#else
  //IFTTTpost.addHeader ( "Content-Type", "text/plain" );
  IFTTTpost.addHeader ( "Content-Type", "application/x-www-form-urlencoded" );

  // IFTTT's text payload is "?&value1=val1&value2=val2&value3=val3"
  String IFTTTrequest = "?&value1=Hey_Man-text-POST";  // no spaces allowed 
  Serial.print ( "  text POST is     <" ); Serial.print ( IFTTTrequest ); Serial.println ( ">" ); 

#endif
  
  int IFTTTreturnCode = IFTTTpost.POST ( IFTTTrequest );     // POST the request to IFTTT

  Serial.print ( " elapsed time in ms = " ); Serial.println ( millis() - elapsed ); 

  Serial.print ( "  return code: " ); Serial.println ( IFTTTreturnCode ); 

  if ( IFTTTreturnCode > 0 ) //Check the returning code (200 is AOK)
  {
    String payload = IFTTTpost.getString();   //Get the request response payload
    Serial.println ( "  response string: <" + payload + ">" );  
  }
  
  IFTTTpost.end();   //Close HTTP connection
  
} // end postToIFTTT

void setup() {
  // initialize serial for debugging
  Serial.begin(115200);
  // initialize serial for ESP module
  Serial1.begin(115200);
  // initialize ESP module
  WiFi.init(&Serial1);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  // you're connected now, so print out the data
  Serial.println("You're connected to the network");
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  digitalWrite(LED_BUILTIN, LOW);   
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);          
}

however, it told me no matching function for call to 'HttpClient::HttpClient()' when i try to compile it.

Arduino: 1.8.15 (Windows 10), Board: "Arduino Uno"

C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino: In function 'void postToIFTTT(const String&)':

wifi8266:30:14: error: no matching function for call to 'HttpClient::HttpClient()'

   HttpClient IFTTTpost;

              ^~~~~~~~~

In file included from C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino:4:0:

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:53:5: note: candidate: HttpClient::HttpClient(Client&, const IPAddress&, uint16_t)

     HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);

     ^~~~~~~~~~

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:53:5: note:   candidate expects 3 arguments, 0 provided

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:52:5: note: candidate: HttpClient::HttpClient(Client&, const String&, uint16_t)

     HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);

     ^~~~~~~~~~

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:52:5: note:   candidate expects 3 arguments, 0 provided

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:51:5: note: candidate: HttpClient::HttpClient(Client&, const char*, uint16_t)

     HttpClient(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);

     ^~~~~~~~~~

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:51:5: note:   candidate expects 3 arguments, 0 provided

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note: candidate: HttpClient::HttpClient(const HttpClient&)

 class HttpClient : public Client

       ^~~~~~~~~~

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note:   candidate expects 1 argument, 0 provided

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note: candidate: HttpClient::HttpClient(HttpClient&&)

C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note:   candidate expects 1 argument, 0 provided

wifi8266:10:25: error: 'MY_IFTTT_SONOFF_APPLET' was not declared in this scope

 #define MY_IFTTT_APPLET MY_IFTTT_SONOFF_APPLET // from IFTTT Applet which consumes the webhook POST

                         ^

C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino:34:74: note: in expansion of macro 'MY_IFTTT_APPLET'

   String IFTTTserverName = "https://maker.ifttt.com/trigger/" + String ( MY_IFTTT_APPLET ) + "/with/key/" + String ( MY_IFTTT_KEY );

                                                                          ^~~~~~~~~~~~~~~

C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino:10:25: note: suggested alternative: 'MY_IFTTT_APPLET'

 #define MY_IFTTT_APPLET MY_IFTTT_SONOFF_APPLET // from IFTTT Applet which consumes the webhook POST

                         ^

C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino:34:74: note: in expansion of macro 'MY_IFTTT_APPLET'

   String IFTTTserverName = "https://maker.ifttt.com/trigger/" + String ( MY_IFTTT_APPLET ) + "/with/key/" + String ( MY_IFTTT_KEY );

                                                                          ^~~~~~~~~~~~~~~

wifi8266:48:13: error: 'class HttpClient' has no member named 'addHeader'; did you mean 'sendHeader'?

   IFTTTpost.addHeader ( "Content-Type", "application/json" );

             ^~~~~~~~~

             sendHeader

wifi8266:65:35: error: 'class HttpClient' has no member named 'POST'

   int IFTTTreturnCode = IFTTTpost.POST ( IFTTTrequest );     // POST the request to IFTTT

                                   ^~~~

wifi8266:73:32: error: 'class HttpClient' has no member named 'getString'; did you mean 'readString'?

     String payload = IFTTTpost.getString();   //Get the request response payload

                                ^~~~~~~~~

                                readString

wifi8266:77:13: error: 'class HttpClient' has no member named 'end'; did you mean 'read'?

   IFTTTpost.end();   //Close HTTP connection

             ^~~

             read

Multiple libraries were found for "HttpClient.h"

 Used: C:\Users\user\Documents\Arduino\libraries\ArduinoHttpClient

 Not used: C:\Program Files (x86)\Arduino\libraries\Bridge

exit status 1

no matching function for call to 'HttpClient::HttpClient()'



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

@neptunewong1998, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

It might be advisable to remove your ssid and password from the code (just replace by something like "xxx".

thank you for ur advise and help

From your link:

It includes one additional library HTTPClient.h.

from your code

Maybe the case matters and you are pulling in a different library.

In an ESP32 sketch I use

#include <HTTPClient.h>

// and later

  WiFiClient client;
  HTTPClient http;

  http.begin(client, fullURL);

without any errors.

1 Like

But I am using ESP8266.

And that entitles you to ignore case?

I only showed you, that there is a different library HTTPClient which works for me.
Obviously the link you posted also uses a library with capital HTTPClient and not HttpClient.

But you don't have to believe me, I just tried to help you.

sorry for it. But I want to use esp8266 instead of esp32. is there anyway to change the code so that it can be use based on esp8266??

the code is not for esp8266 but for a MCU using esp8266 with AT firmware as network adapter.
Which HttpCliet library do you use? check the examples of the library

the library that i am using is ArduinoHttpClient

// Class to simplify HTTP fetching on Arduino
// (c) Copyright MCQN Ltd. 2010-2012
// Released under Apache License, version 2.0

#ifndef HttpClient_h
#define HttpClient_h

#include <Arduino.h>
#include <IPAddress.h>
#include "Client.h"

static const int HTTP_SUCCESS =0;
// The end of the headers has been reached.  This consumes the '\n'
// Could not connect to the server
static const int HTTP_ERROR_CONNECTION_FAILED =-1;
// This call was made when the HttpClient class wasn't expecting it
// to be called.  Usually indicates your code is using the class
// incorrectly
static const int HTTP_ERROR_API =-2;
// Spent too long waiting for a reply
static const int HTTP_ERROR_TIMED_OUT =-3;
// The response from the server is invalid, is it definitely an HTTP
// server?
static const int HTTP_ERROR_INVALID_RESPONSE =-4;

// Define some of the common methods and headers here
// That lets other code reuse them without having to declare another copy
// of them, so saves code space and RAM
#define HTTP_METHOD_GET    "GET"
#define HTTP_METHOD_POST   "POST"
#define HTTP_METHOD_PUT    "PUT"
#define HTTP_METHOD_PATCH  "PATCH"
#define HTTP_METHOD_DELETE "DELETE"
#define HTTP_HEADER_CONTENT_LENGTH "Content-Length"
#define HTTP_HEADER_CONTENT_TYPE   "Content-Type"
#define HTTP_HEADER_CONNECTION     "Connection"
#define HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
#define HTTP_HEADER_USER_AGENT     "User-Agent"
#define HTTP_HEADER_VALUE_CHUNKED  "chunked"

class HttpClient : public Client
{
public:
    static const int kNoContentLengthHeader =-1;
    static const int kHttpPort =80;
    static const char* kUserAgent;

// FIXME Write longer API request, using port and user-agent, example
// FIXME Update tempToPachube example to calculate Content-Length correctly

    HttpClient(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);
    HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);
    HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);

    /** Start a more complex request.
        Use this when you need to send additional headers in the request,
        but you will also need to call endRequest() when you are finished.
    */
    void beginRequest();

    /** End a more complex request.
        Use this when you need to have sent additional headers in the request,
        but you will also need to call beginRequest() at the start.
    */
    void endRequest();

    /** Start the body of a more complex request.
        Use this when you need to send the body after additional headers
        in the request, but can optionally call endRequest() when
        you are finished.
    */
    void beginBody();

    /** Connect to the server and start to send a GET request.
      @param aURLPath     Url to request
      @return 0 if successful, else error
    */
    int get(const char* aURLPath);
    int get(const String& aURLPath);

    /** Connect to the server and start to send a POST request.
      @param aURLPath     Url to request
      @return 0 if successful, else error
    */
    int post(const char* aURLPath);
    int post(const String& aURLPath);

    /** Connect to the server and send a POST request
        with body and content type
      @param aURLPath     Url to request
      @param aContentType Content type of request body
      @param aBody        Body of the request
      @return 0 if successful, else error
    */
    int post(const char* aURLPath, const char* aContentType, const char* aBody);
    int post(const String& aURLPath, const String& aContentType, const String& aBody);
    int post(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);

    /** Connect to the server and start to send a PUT request.
      @param aURLPath     Url to request
      @return 0 if successful, else error
    */
    int put(const char* aURLPath);
    int put(const String& aURLPath);

    /** Connect to the server and send a PUT request
        with body and content type
      @param aURLPath     Url to request
      @param aContentType Content type of request body
      @param aBody        Body of the request
      @return 0 if successful, else error
    */
    int put(const char* aURLPath, const char* aContentType, const char* aBody);
    int put(const String& aURLPath, const String& aContentType, const String& aBody);
    int put(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);

    /** Connect to the server and start to send a PATCH request.
      @param aURLPath     Url to request
      @return 0 if successful, else error
    */
    int patch(const char* aURLPath);
    int patch(const String& aURLPath);

    /** Connect to the server and send a PATCH request
        with body and content type
      @param aURLPath     Url to request
      @param aContentType Content type of request body
      @param aBody        Body of the request
      @return 0 if successful, else error
    */
    int patch(const char* aURLPath, const char* aContentType, const char* aBody);
    int patch(const String& aURLPath, const String& aContentType, const String& aBody);
    int patch(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);

    /** Connect to the server and start to send a DELETE request.
      @param aURLPath     Url to request
      @return 0 if successful, else error
    */
    int del(const char* aURLPath);
    int del(const String& aURLPath);

    /** Connect to the server and send a DELETE request
        with body and content type
      @param aURLPath     Url to request
      @param aContentType Content type of request body
      @param aBody        Body of the request
      @return 0 if successful, else error
    */
    int del(const char* aURLPath, const char* aContentType, const char* aBody);
    int del(const String& aURLPath, const String& aContentType, const String& aBody);
    int del(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);

    /** Connect to the server and start to send the request.
        If a body is provided, the entire request (including headers and body) will be sent
      @param aURLPath        Url to request
      @param aHttpMethod     Type of HTTP request to make, e.g. "GET", "POST", etc.
      @param aContentType    Content type of request body (optional)
      @param aContentLength  Length of request body (optional)
      @param aBody           Body of request (optional)
      @return 0 if successful, else error
    */
    int startRequest(const char* aURLPath,
                     const char* aHttpMethod,
                     const char* aContentType = NULL,
                     int aContentLength = -1,
                     const byte aBody[] = NULL);

    /** Send an additional header line.  This can only be called in between the
      calls to beginRequest and endRequest.
      @param aHeader Header line to send, in its entirety (but without the
                     trailing CRLF.  E.g. "Authorization: Basic YQDDCAIGES"
    */
    void sendHeader(const char* aHeader);

    void sendHeader(const String& aHeader)
      { sendHeader(aHeader.c_str()); }

    /** Send an additional header line.  This is an alternate form of
      sendHeader() which takes the header name and content as separate strings.
      The call will add the ": " to separate the header, so for example, to
      send a XXXXXX header call sendHeader("XXXXX", "Something")
      @param aHeaderName Type of header being sent
      @param aHeaderValue Value for that header
    */
    void sendHeader(const char* aHeaderName, const char* aHeaderValue);

    void sendHeader(const String& aHeaderName, const String& aHeaderValue)
      { sendHeader(aHeaderName.c_str(), aHeaderValue.c_str()); }

    /** Send an additional header line.  This is an alternate form of
      sendHeader() which takes the header name and content separately but where
      the value is provided as an integer.
      The call will add the ": " to separate the header, so for example, to
      send a XXXXXX header call sendHeader("XXXXX", 123)
      @param aHeaderName Type of header being sent
      @param aHeaderValue Value for that header
    */
    void sendHeader(const char* aHeaderName, const int aHeaderValue);

    void sendHeader(const String& aHeaderName, const int aHeaderValue)
      { sendHeader(aHeaderName.c_str(), aHeaderValue); }

    /** Send a basic authentication header.  This will encode the given username
      and password, and send them in suitable header line for doing Basic
      Authentication.
      @param aUser Username for the authorization
      @param aPassword Password for the user aUser
    */
    void sendBasicAuth(const char* aUser, const char* aPassword);

    void sendBasicAuth(const String& aUser, const String& aPassword)
      { sendBasicAuth(aUser.c_str(), aPassword.c_str()); }

    /** Get the HTTP status code contained in the response.
      For example, 200 for successful request, 404 for file not found, etc.
    */
    int responseStatusCode();

    /** Check if a header is available to be read.
      Use readHeaderName() to read header name, and readHeaderValue() to
      read the header value
      MUST be called after responseStatusCode() and before contentLength()
    */
    bool headerAvailable();

    /** Read the name of the current response header.
      Returns empty string if a header is not available.
    */
    String readHeaderName();

    /** Read the vallue of the current response header.
      Returns empty string if a header is not available.
    */
    String readHeaderValue();

    /** Read the next character of the response headers.
      This functions in the same way as read() but to be used when reading
      through the headers.  Check whether or not the end of the headers has
      been reached by calling endOfHeadersReached(), although after that point
      this will still return data as read() would, but slightly less efficiently
      MUST be called after responseStatusCode() and before contentLength()
      @return The next character of the response headers
    */
    int readHeader();

    /** Skip any response headers to get to the body.
      Use this if you don't want to do any special processing of the headers
      returned in the response.  You can also use it after you've found all of
      the headers you're interested in, and just want to get on with processing
      the body.
      MUST be called after responseStatusCode()
      @return HTTP_SUCCESS if successful, else an error code
    */
    int skipResponseHeaders();

    /** Test whether all of the response headers have been consumed.
      @return true if we are now processing the response body, else false
    */
    bool endOfHeadersReached();

    /** Test whether the end of the body has been reached.
      Only works if the Content-Length header was returned by the server
      @return true if we are now at the end of the body, else false
    */
    bool endOfBodyReached();
    virtual bool endOfStream() { return endOfBodyReached(); };
    virtual bool completed() { return endOfBodyReached(); };

    /** Return the length of the body.
      Also skips response headers if they have not been read already
      MUST be called after responseStatusCode()
      @return Length of the body, in bytes, or kNoContentLengthHeader if no
      Content-Length header was returned by the server
    */
    int contentLength();

    /** Returns if the response body is chunked
      @return true if response body is chunked, false otherwise
    */
    int isResponseChunked() { return iIsChunked; }

    /** Return the response body as a String
      Also skips response headers if they have not been read already
      MUST be called after responseStatusCode()
      @return response body of request as a String
    */
    String responseBody();

    /** Enables connection keep-alive mode
    */
    void connectionKeepAlive();

    /** Disables sending the default request headers (Host and User Agent)
    */
    void noDefaultRequestHeaders();

    // Inherited from Print
    // Note: 1st call to these indicates the user is sending the body, so if need
    // Note: be we should finish the header first
    virtual size_t write(uint8_t aByte) { if (iState < eRequestSent) { finishHeaders(); }; return iClient-> write(aByte); };
    virtual size_t write(const uint8_t *aBuffer, size_t aSize) { if (iState < eRequestSent) { finishHeaders(); }; return iClient->write(aBuffer, aSize); };
    // Inherited from Stream
    virtual int available();
    /** Read the next byte from the server.
      @return Byte read or -1 if there are no bytes available.
    */
    virtual int read();
    virtual int read(uint8_t *buf, size_t size);
    virtual int peek() { return iClient->peek(); };
    virtual void flush() { iClient->flush(); };

    // Inherited from Client
    virtual int connect(IPAddress ip, uint16_t port) { return iClient->connect(ip, port); };
    virtual int connect(const char *host, uint16_t port) { return iClient->connect(host, port); };
    virtual void stop();
    virtual uint8_t connected() { return iClient->connected(); };
    virtual operator bool() { return bool(iClient); };
    virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; };
    virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; };
protected:
    /** Reset internal state data back to the "just initialised" state
    */
    void resetState();

    /** Send the first part of the request and the initial headers.
      @param aURLPath	Url to request
      @param aHttpMethod  Type of HTTP request to make, e.g. "GET", "POST", etc.
      @return 0 if successful, else error
    */
    int sendInitialHeaders(const char* aURLPath,
                     const char* aHttpMethod);

    /* Let the server know that we've reached the end of the headers
    */
    void finishHeaders();

    /** Reading any pending data from the client (used in connection keep alive mode)
    */
    void flushClientRx();

    // Number of milliseconds that we wait each time there isn't any data
    // available to be read (during status code and header processing)
    static const int kHttpWaitForDataDelay = 1000;
    // Number of milliseconds that we'll wait in total without receiveing any
    // data before returning HTTP_ERROR_TIMED_OUT (during status code and header
    // processing)
    static const int kHttpResponseTimeout = 30*1000;
    static const char* kContentLengthPrefix;
    static const char* kTransferEncodingChunked;
    typedef enum {
        eIdle,
        eRequestStarted,
        eRequestSent,
        eReadingStatusCode,
        eStatusCodeRead,
        eReadingContentLength,
        eSkipToEndOfHeader,
        eLineStartingCRFound,
        eReadingBody,
        eReadingChunkLength,
        eReadingBodyChunk
    } tHttpState;
    // Client we're using
    Client* iClient;
    // Server we are connecting to
    const char* iServerName;
    IPAddress iServerAddress;
    // Port of server we are connecting to
    uint16_t iServerPort;
    // Current state of the finite-state-machine
    tHttpState iState;
    // Stores the status code for the response, once known
    int iStatusCode;
    // Stores the value of the Content-Length header, if present
    int iContentLength;
    // How many bytes of the response body have been read by the user
    int iBodyLengthConsumed;
    // How far through a Content-Length header prefix we are
    const char* iContentLengthPtr;
    // How far through a Transfer-Encoding chunked header we are
    const char* iTransferEncodingChunkedPtr;
    // Stores if the response body is chunked
    bool iIsChunked;
    // Stores the value of the current chunk length, if present
    int iChunkLength;
    uint32_t iHttpResponseTimeout;
    bool iConnectionClose;
    bool iSendDefaultRequestHeaders;
    String iHeaderLine;
};

#endif

I am not sure if i do the right things. I changed my include statement to

#include "ESP8266HTTPClient.h"

However, this time it shows

In file included from C:\Users\user\Documents\Arduino\libraries\ESP8266_Webhooks/ESP8266HTTPClient.h:30:0,
                 from C:\Users\user\Documents\Arduino\wifi8266\wifi8266.ino:4:
C:\Users\user\Documents\Arduino\libraries\ESP8266_Webhooks/StreamString.h:26:10: fatal error: limits: No such file or directory
 #include <limits>
          ^~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.

why would you change the include to ESP8266HTTPClient.h. you are not on an esp8266. you are on Uno.

see the example of the ArduinoHttpClient library.

Since you didn't show how things are connected- I am assuming that you are trying to use an ESP module (you also didn't say which one) to provide WiFi to an Uno?

To quote my favorite robot, "This will all end in tears. I just know it."

Some have managed to get an ESP to work as a WiFi shield for the Arduino, but it was not without a lot of unnecessary work.

If you need WiFi, why not simply begin with a board that already has WiFi, like the Wemos D1 Mini or NodeMCU or an ESP32 board?

That's not an ESP8266.

That's telling you the you have to pass some arguments to the constructor. You choices are:
HttpClient IFTTTpost(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
or
HttpClient IFTTTpost(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);
or
HttpClient IFTTTpost(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);

In other words, you have to create a "Client" (like EthernetClient or WiFiClient) before you can create the corresponding HttpClient. You also need to know the target server's name or address and (optionally) HTTP port (defaults to 80).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.