Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mob = '39829374'
- mmessage = 'Hi'
- username='username'
- pwd='password'
- mmob1 =ALLTRIM(mmob )
- MMOB = '00973'+ALLTRIM(mmob )
- From='AMA Motors'
- to = '&mmob'
- lcMessage=mmessage
- lcNexmo = Textmerge("http://rest.nexmo.com/sms/xml?username=<< m.username >>|password=<< m.pwd >>|from=<< m.from >>|to=<< m.to >>|text=<< m.lcMessage >>")
- lcNexmo = Chrtran(m.lcNexmo, '|', Chr(38))
- * Message parameters ready
- Local loXmlHttp As "Microsoft.XMLHTTP"
- loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
- loXmlHttp.Open( "POST" , m.lcNexmo, .F. )
- loXmlHttp.Send( )
- If loXmlHttp.Status = 200
- lcXML =
- StrExtract(loXmlHttp.responsetext,'<messages','</messages>',1,1+4)
- XMLToCursor(m.lcXML,'myresult')
- * browse
- Else
- MessageBox( Textmerge( "An error occurred in SMS. Status <<loXmlHttp.STATUS>> (<<loXmlHttp.statustext>>)." ) )
- Endif
- NexmoKey = '1b37ecc8'
- NexmoSecret = 'df183c07'
- NexmoNumber = 'AMA Motors'
- mob = '39829374'
- mmessage = 'Hi'
- MMOB = '00973'+ALLTRIM(m.mob )
- to = m.mmob
- lcMessage = m.mmessage
- nexmoURL = Textmerge(;
- "https://rest.nexmo.com/sms/xml?"+;
- "username=<< m.NexmoKey >>|"+;
- "password=<< m.NexmoSecret >>|"+;
- "from=<< m.NexmoNumber >>")
- TrySendTTS(m.to,m.lcMessage, m.NexmoUrl)
- Procedure TrySendTTS(tcPhone,tcMessage, tcNexmoUrl)
- tcMessage = Strtran(m.tcMessage, '%0A', '%0D%0A')
- lcUrl = Chrtran(;
- Textmerge("<< m.tcNexmoUrl >>|to=<< m.tcPhone >>|text=<< m.tcMessage >>"), '|', Chr(38))
- Local loXmlHttp As "Microsoft.XMLHTTP"
- loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
- loXmlHttp.Open( "POST" , m.lcUrl, .F. )
- * loXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
- loXmlHttp.Send( )
- ? loXmlHttp.Status = 200
- ? loXmlHttp.responsetext
- Endproc
- <?xml version='1.0' encoding='UTF-8' ?>
- <mt-submission-response>
- <messages count='1'>
- <message>
- <to>97339829374</to>
- <messageId>0B00000044C5B1ED</messageId>
- <status>0</status>
- <remainingBalance>6.23650000</remainingBalance>
- <messagePrice>0.01740000</messagePrice>
- <network>42601</network>
- </message>
- </messages>
- </mt-submission-response>
Add Comment
Please, Sign In to add comment