Ok I’ve tried everything. I’ve dug through the community looking for people whom have had the same issue, and there are a few close matches, but their solutions never seem to work for me…
I’ve tried the HttpClient library, and can’t get it to work. It keeps telling me connection failed.
I tried the web sockets library. Connection failed.
For the life of me I can’t seem to figure out what I’m doing wrong.
#include "HttpClient/HttpClient.h"
// This #include statement was automatically added by the Spark IDE.
HttpClient client;
http_header_t headers[] = {
// { "Content-Type", "application/json" },
// { "Accept" , "application/json" },
{ "Accept" , "*/*"},
{ NULL, NULL } // NOTE: Always terminate headers will NULL
};
http_request_t request;
http_response_t response;
IPAddress server(192,168,1,132);
void setup() {
Serial.begin(9600);
request.ip = server;
request.port = 8084;
client.get(request, response, headers);
}
void loop() {
}
I’m using a local server on my home network. I tried using my “real” IP and port forwarding through my router… Nothing. I tried giving it an IP as was suggested in another thread… Nothing.
Anyone have any ideas?
I’ve edited your post to properly format the code. Please check out this post, so you know how to do this yourself in the future. Thanks in advance! ~Jordy