#property version "1.00" #property description "TLSLab WebRequest check for https://localhost:8443" input string InpEndpoint = "https://localhost:8443/whoami"; input int InpTimeoutMs = 5000; input int InpIntervalSec = 10; int OnInit() { EventSetTimer(InpIntervalSec); Check(); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { EventKillTimer(); } void OnTimer() { Check(); } void Check() { char data[]; ArrayResize(data, 0); char result[]; string headers = ""; ResetLastError(); int code = WebRequest("GET", InpEndpoint, NULL, NULL, InpTimeoutMs, data, 0, result, headers); if(code == -1) { int err = GetLastError(); PrintFormat("WebRequest failed: error %d", err); if(err == 4014) Print("Allow this URL in Tools > Options > Expert Advisors > Allow WebRequest for listed URL: https://localhost:8443"); return; } string body = CharArrayToString(result, 0, WHOLE_ARRAY, CP_UTF8); PrintFormat("HTTP %d, %d bytes", code, ArraySize(result)); Print(body); }