So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By BoyNextDoor
#92104 #include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>

const String ssid = "xx";
const String password = "xx";

String title;
String url;

WiFiClient client;

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}

Serial.print("CONNECTED TO ");
Serial.println(ssid);

getnews();
}

void loop()
{

}

bool getnews()
{
if (!client.connect("jsonplaceholder.typicode.com", 443)) {
Serial.println(F("Connection failed"));
}
client.print(String("GET /users/1") + " HTTP/1.1\r\n" + "Host: " + "jsonplaceholder.typicode.com" + "\r\n" + "Connection: close\r\n\r\n");

while(client.available())
{
String line = client.readStringUntil('\r');
Serial.print(line);
}

client.stop();
}


Trying to parse but that's all I get
Image