public static WebHtmlObject DownloadHtmlWebsiteOrApi(string ip, string user, string password) { string apiUrl = $"http://{ip}/cgi-bin/miner_stats.cgi"; string websiteUrl = $"http://{ip}/cgi-bin/minerStatus.cgi"; WebHtmlObject webHtmlObject = new WebHtmlObject(); try { DigestAuthFixer digestApi = new DigestAuthFixer(apiUrl, user, password); webHtmlObject.ApiHtml = digestApi.GrabResponse(apiUrl); } catch (Exception) { // ignored } try { DigestAuthFixer digestWebsite = new DigestAuthFixer(websiteUrl, user, password); webHtmlObject.HtmlWebSiteWebsite = digestWebsite.GrabResponse(websiteUrl); } catch (Exception) { // ignored } return(webHtmlObject); }
public static string DownloadString(string url, string user, string password) { string html = default; try { DigestAuthFixer digest = new DigestAuthFixer(url, user, password); html = digest.GrabResponse(url); } catch (Exception) { // ignored } return(html); }