PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
SMS Tools
Published by Boller
in the category Tools
New features
SMS Tools - Project to send SMS, just request username and new password for webservice site and is ready to use




http://209.133.205.2/painel/ServiceSms.asmx

http://209.133.205.2/painel/api.ashx?action=sendsms

Description
SMS Tools - Project to send SMS, just request username and new password for webservice site and is ready to use

SERVICESMS

http://209.133.205.2/painel/ServiceSms.asmx

API SEND SMS

http://209.133.205.2/painel/api.ashx?action=sendsms
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
João Ferreira
url is string ="https://api.smsbuzz.net/api/accesstoken"
via_post is boolean = True
cont_type is string ="application/json"

//CORPO
xSMSJson is Variant
xSMSJson.Campaign = "Bikespot"
xSMSJson.SenderName = "BikeSpot_Lda"
xSMSJson.Destinations = "00351935554853"
xSMSJson.Text = "Experiência com sucesso"
let sElementosSMS=VariantToJSON(xSMSJson)

//sElementosSMS is string = [
//{
//}
//]

garry_parametros_header[2].s_nome_parametro = "Username"
garry_parametros_header[2].s_valor_parametro = "914b918c20d5419ea2345200421635a6"

garry_parametros_header[3].s_nome_parametro = "Password"
garry_parametros_header[3].s_valor_parametro = "609b6c03-8f42-43a6-8b5b-62da77205354"


respget is string = HttpExecutarRestApi(url,sElementosSMS,via_post,garry_parametros_header,False,cont_type)




//xdados is Variant
//xdados.Username = "914b918c20d5419ea2345200421635a6"
//xdados.Password = "609b6c03-8f42-43a6-8b5b-62da77205354"
//
//varhttp is a httpRequest
//varhttp.Method=httpPost
//varhttp.URL="https://api.smsbuzz.net/api/accesstoken"
//
//let sObtemToken=VariantToJSON(xdados)
//varhttp.ContentType=typeMimeJSON
//varhttp.Content=sObtemToken
//
//respget is restResponse=RESTSend(varhttp) // obtem o token para poder agregar no envio de SMS
//
////CORPO
//xSMS is Variant
//xSMS.Campaign = "Bikespot"
//xSMS.SenderName = "BikeSpot_Lda"
//xSMS.Destinations = "00351935554853"
//xSMS.Text = "Experiência com sucesso"
//let sElementosSMS=VariantToJSON(xSMS)

// tentativa de criação de uma variável token do tipo Bearer
//xtoken is a token
//xtoken.Value="Bearer"+respget.Content

// HEADER COM O TOKEN
xheader is Variant
xheader.Authorization..Value = "Bearer"
xheader.Authorization..Value=respget // experiência 1 falhada
//xheader.Authorization..Type = "Bearer"+respget.Content // experiência 1 falhada
//xheader.Headers.Add("Authorization","Bearer "+respget.Content); // experiencia 2 falhada
//xheader.Authorization = xtoken tentativa 3 falhada
let sTomaToken=VariantToJSON(xheader)

// A PREPARAÇÃO DO CONTEÚDO DO SMS A ENVIAR AO TELEMÓVEL
ehttp is a httpRequest
ehttp..Method=httpPost
ehttp..Header[1]=sTomaToken

ehttp.ContentType=typeMimeJSON
ehttp.Content=sElementosSMS

ehttp.URL="https://api.smsbuzz.net/sms/send"
RespPosta is restResponse=RESTSend(ehttp)

IF RespPosta.StatusCode=200 THEN
Info("Bem Sucedido")
ELSE
Error("Erro ao processar o comando","Código do erro:"+RespPosta.StatusCode,"Descrição do erro:"+RespPosta.DescriptionStatusCode)
END


//--------------------------------------------------------

PROCEDURE HttpExecutarRestApi(s_url is string,
BlocoCodeJsonXml is string,
b_via_post is boolean,
arr_header_parametros is array of ST_parametros_header,
b_codificar_parametros is boolean = True,
s_content_type is string = "" )
//Http Rest
WHEN EXCEPTION IN

//info(1)
nTempo_ocioso is int = 0

gbResultOK is boolean

sResultado, sUltimo_erro is string


ChangeCharset(charsetOccidental) // SEM ACENTO


HourGlass(True)

cMyRequest is a httpRequest

cMyResponse is a httpResponse

cMyRequest..URL = s_url

//cMyRequest..TimeOutConnexion = 30000

//info(2)

IF Length(BlocoCodeJsonXml) > 0 THEN
IF b_codificar_parametros OR PositionOccurrence(BlocoCodeJsonXml,"{",firstRank,WholeWord) = 0
cMyRequest..Content = URLEncode(BlocoCodeJsonXml)
ELSE
cMyRequest..Content = BlocoCodeJsonXml
END
END

IF s_content_type <> "" THEN
cMyRequest..ContentType = s_content_type
END

IF b_via_post = True THEN
cMyRequest..Method = httpPost //2
ELSE
cMyRequest..Method = httpGet //1
END

IF ArrayCount(arr_header_parametros) > 0 THEN
FOR EACH st_parametro OF arr_header_parametros
cMyRequest.Header[st_parametro.s_nome_parametro] = st_parametro.s_valor_parametro
END
END

//info(3)

//Executa a requisição

gbResultOK = False

cMyResponse = RESTSend ( cMyRequest )

//info(4)

Trace("--------------------------------------")

Trace("URL "+cMyRequest..URL)

Trace("Envio: " + cMyRequest..Method +CR+ cMyRequest..Content +CR+ cMyRequest..ContentType)

Trace("Retorno: " +cMyResponse..Content)

Trace("--------------------------------------")




IF ErrorOccurred OR PositionOccurrence(cMyResponse..Content,"DOCTYPE html PUBLIC",firstRank,FromBeginning) > 0

gbResultOK = False

sUltimo_erro = s_url+ BlocoCodeJsonXml +" "+ ErrorInfo(errFullDetails)

HourGlass(False)

Add(garry_Resultado,False)

RESULT False

ELSE

gbResultOK = True

sResultado = NoAccent(cMyResponse..Content)

Add(garry_Resultado,cMyResponse..Header)
Add(garry_Resultado,cMyResponse..Content)
Add(garry_Resultado,cMyResponse..ContentType)
Add(garry_Resultado,cMyResponse..DescriptionStatusCode)
Add(garry_Resultado,cMyResponse..RoughHeader)
Add(garry_Resultado,cMyResponse..StatusCode)
Add(garry_Resultado,True)

HourGlass(False)

RESULT sResultado

END



DO

gbResultOK = False

Add(garry_Resultado,False)

HourGlass(False)

RESULT False

END



//---------------------------------------------

GLOBAL
gsUser is string
garry_Resultado is array of string
//esta Structure é usado para passar parametros ao HEADER do request
ST_parametros_header est Structure
s_nome_parametro est chaîne
s_valor_parametro est chaîne
FIN
garry_parametros_header is array of ST_parametros_header