public void WebReq(String ApiUrl, String Tel, String Nome) { String Result = ""; String TextFormat = ""; WhatsAppSendPST Send; Hlp Hlp; ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return(true); }; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; using (WebClient WebPost = new WebClient()) { NameValueCollection WebFields = null; Byte[] WebResponse = null; try { Hlp = new Hlp(); Send = new WhatsAppSendPST(); WebFields = new NameValueCollection(); Send.Cmd = "chat"; String[] NomeFormat = Nome.Split(' '); TextFormat = Rtxt_Texto.Text.Replace("{nome}", NomeFormat[0]); TextFormat = TextFormat.Replace("{hix}", "Texto fixo 1"); TextFormat = TextFormat.Replace("{hi}", "Texto fixo 2"); TextFormat = TextFormat.Replace("{comprimento}", Hlp.RandomTalk()); TextFormat = TextFormat.Replace("{comprimentoplus}", Hlp.RandomTalk(NomeFormat[0])); Send.Texto = TextFormat; if (!String.IsNullOrEmpty(txt_img.Text)) { Send.Cmd = "image"; Send.UrlImg = txt_img.Text; } /* * * //Waboxapp * WebFields["token"] = TOKEN; * WebFields["uid"] = REMETENTE; * WebFields["to"] = Tel; * WebFields["custom_uid"] = Hlp.RandomIdGenerator(); * WebFields["text"] = Send.Texto; * * if (!String.IsNullOrEmpty(txt_img.Text)) * { * WebFields["url"] = Send.UrlImg; * WebFields["caption"] = Send.Titulo; * WebFields["description"] = Send.Descricao; * } */ //Winzap WebFields["token"] = TOKEN; WebFields["cmd"] = Send.Cmd; WebFields["id"] = Hlp.RandomIdGenerator(); WebFields["de"] = "5581" + txt_remetente.Text; WebFields["para"] = Tel; WebFields["msg"] = Send.Texto; if (!String.IsNullOrEmpty(txt_img.Text)) { WebFields["link"] = Send.UrlImg; } MessageBox.Show(Send.Texto); //WebResponse = WebPost.UploadValues(ApiUrl, "POST", WebFields); //Result = HTTP_ENCODING.GetString(WebResponse); Result = "{\"message\":\"sucesso\"}"; if (Result == SUCCESS) { dataGridView2.Rows.Add(Nome, Tel, "ENVIADO"); } } catch (Exception e) { MessageBox.Show(e.Message + ""); } finally { WebFields = null; WebResponse = null; } } }