private void DoLogon() { try { requestHelper.LoadRequest("https://siga.cps.sp.gov.br/aluno/login.aspx"); string postData = SigaHelper.PostDataLogon( ConfigurationManager.AppSettings["UsuarioSiga"].ToString(), ConfigurationManager.AppSettings["SenhaSiga"].ToString() ); requestHelper.Host("siga.cps.sp.gov.br"); requestHelper.ContentType("application/x-www-form-urlencoded"); requestHelper.UserAgent("Mozilla / 5.0(Windows NT 10.0; Win64; x64) AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 76.0.3809.132 Safari / 537.36"); requestHelper.Accept("*/*"); requestHelper.KeepAlive(true); requestHelper.Referer("https://siga.cps.sp.gov.br/aluno/login.aspx"); requestHelper.AddRequestHeader(HttpRequestHeader.Cookie, "ASP.NET_SessionId = n5dfhwy2y405jk55z0x25k55"); requestHelper.AddRequestHeader("Origin", "https://siga.cps.sp.gov.br"); requestHelper.ExecuteRequest("POST", postData); } catch (Exception ex) { throw ex; } }
private void AccessWebSite() { try { requestHelper = new RequestHelper("https://siga.cps.sp.gov.br/aluno/login.aspx"); requestHelper.Accept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"); requestHelper.UserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"); requestHelper.AddRequestHeader("Accept-Encoding", "gzip, deflate, br"); requestHelper.AddRequestHeader("Accept-Language", "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7"); requestHelper.ExecuteRequest("GET"); } catch (Exception ex) { throw ex; } }
private void AcessaTradutor() { try { requestHelper = new RequestHelper("https://translate.google.com/"); requestHelper.Host("translate.google.com"); requestHelper.KeepAlive(true); requestHelper.AddRequestHeader("Upgrade-Insecure-Requests", "1"); requestHelper.UserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"); requestHelper.Accept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"); requestHelper.AddRequestHeader("Sec-Fetch-Site", "none"); requestHelper.AddRequestHeader(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br"); requestHelper.AddRequestHeader(HttpRequestHeader.AcceptLanguage, "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7"); requestHelper.ExecuteRequest("GET"); } catch (Exception ex) { throw ex; } }
private void EnviaTraducao(string expressao) { try { requestHelper.LoadRequest("https://translate.google.com/translate_a/t" + TranslateHelper.ParametrosTraducao(expressao)); requestHelper.Host("translate.google.com"); requestHelper.KeepAlive(true); requestHelper.AddRequestHeader("Upgrade-Insecure-Requests", "1"); requestHelper.UserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"); requestHelper.Accept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"); requestHelper.AddRequestHeader("Sec-Fetch-Site", "none"); requestHelper.AddRequestHeader(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br"); requestHelper.AddRequestHeader(HttpRequestHeader.AcceptLanguage, "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7"); requestHelper.ExecuteRequest("GET"); string response = requestHelper.GetResponseBody(); string retorno = response.Substring(response.IndexOf("\"") + 1); retorno = retorno.Substring(0, retorno.IndexOf("\"")); } catch (Exception ex) { throw ex; } }