A
Arduino3y ago
wtf

Get Website HTML

I'm trying to get a website's html, but it doesn't work with my current code
WiFiClientSecure client;
client.setInsecure();

HTTPClient https;
if (https.begin(client, request_url))
{
Serial.printf("Requesting %s\n", request_url.c_str());
int status_code = https.GET();
if (status_code != 200)
{
Serial.printf("Got status code %d\n", status_code);
https.end();
return false;
}

String html = https.getString();
Serial.printf("Status: %d\nGot HTML: %s\n", status_code, html.c_str());
}
https.end();
WiFiClientSecure client;
client.setInsecure();

HTTPClient https;
if (https.begin(client, request_url))
{
Serial.printf("Requesting %s\n", request_url.c_str());
int status_code = https.GET();
if (status_code != 200)
{
Serial.printf("Got status code %d\n", status_code);
https.end();
return false;
}

String html = https.getString();
Serial.printf("Status: %d\nGot HTML: %s\n", status_code, html.c_str());
}
https.end();
1 Reply
Silent
Silent3y ago
You need to provide more information. You only shared part of the code and you don't say what you are getting (output/messages)

Did you find this page helpful?