#include <ArduinoJson.h>
#include <ESP8266WiFi.h>

const char* ssid = "CMCC-j3vt";
const char* password = "qq282246101";


void setup() {
  Serial.begin(115200);
  delay(10);

  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

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

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}
String MyHttpsGet(String host, String url) {
  // Use WiFiClient class to create TCP connections
  WiFiClientSecure client;
  const int httpPort = 443;
  client.setInsecure(); 
  if (!client.connect(host, httpPort)) { 
    Serial.println("connection failed");
    return "";
  }

  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");
  String ss;
  while (client.connected())
  {
    String line = client.readStringUntil('\n');
    if (line.length() != 0) {
      ss = ss + line;
    }
  }
  return ss.substring(ss.lastIndexOf("Connection: close") + 17);
  client.stop();
}
void loop() {
  String host = "www.360xyz.cn";
  String url = "/query/GetDate";

  String a = MyHttpsGet(host, url);
  Serial.println(a);
  delay(10000);
}