0
I’m wanting to text through this url;
https://www.iagentesms.com.br/webservices/http.php?metodo=envio
&usuario=iagente
&senha=12345
&celular=5199999999
&mensagem=teste+integracao+http
But I don’t know how to make that call. My code:
public static void EnviarSmsOnly(string celular, string mensagem)
{
if (celular != null || mensagem != null)
{
string endereco = "https://www.iagentesms.com.br/webservices/http.php?metodo=envio";
string usuario = "&usuario=user";
string senha = "&senha=senha";
string celularSoNumero = Util.RemoveNaoNumericos(celular);
string destinatario = "&celular=" + celularSoNumero;
string msg = "&mensagem=" + mensagem;
string url = endereco + usuario + senha + destinatario + msg ;
//Aqui já não sei fazer.
WebRequest requisicao = WebRequest.Create(url); ;
requisicao.ContentType = "application/x-www-form-urlencoded";
requisicao.Method = "GET";
requisicao.GetResponseAsync();
}
}
API website: https://www.iagente.com.br/api/sms . Grateful from now on.
Nothing happens? Is there an error? Is there any tutorial for this request, configuration, website etc...
– novic
Nothing happens @Virgilionovic, follow the tutorial: https://www.iagente.com.br/api/sms
– João Chagas
take a look at this example, I think it will help you. https://docs.microsoft.com/pt-br/dotnet/api/system.net.webrequest?view=netframework-4.8
– JcSaint
I followed the tutorial but it failed. "Authentication failed because the remote participant closed the transport flow." Line 102: Httpwebresponse Response = (Httpwebresponse)request.Getresponse();
– João Chagas
You have an error in authentication, ie hard to play local error.
– novic