Guest User

Untitled

a guest
Feb 9th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. mob = '39829374'
  2.  
  3. mmessage = 'Hi'
  4.  
  5. username='username'
  6.  
  7. pwd='password'
  8.  
  9. mmob1 =ALLTRIM(mmob )
  10.  
  11. MMOB = '00973'+ALLTRIM(mmob )
  12.  
  13.  
  14. From='AMA Motors'
  15.  
  16. to = '&mmob'
  17.  
  18. lcMessage=mmessage
  19.  
  20. lcNexmo = Textmerge("http://rest.nexmo.com/sms/xml?username=<< m.username >>|password=<< m.pwd >>|from=<< m.from >>|to=<< m.to >>|text=<< m.lcMessage >>")
  21.  
  22. lcNexmo = Chrtran(m.lcNexmo, '|', Chr(38))
  23.  
  24. * Message parameters ready
  25.  
  26.  
  27. Local loXmlHttp As "Microsoft.XMLHTTP"
  28.  
  29. loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
  30.  
  31.  
  32. loXmlHttp.Open( "POST" , m.lcNexmo, .F. )
  33.  
  34. loXmlHttp.Send( )
  35.  
  36.  
  37. If loXmlHttp.Status = 200
  38.  
  39. lcXML =
  40. StrExtract(loXmlHttp.responsetext,'<messages','</messages>',1,1+4)
  41.  
  42. XMLToCursor(m.lcXML,'myresult')
  43.  
  44. * browse
  45.  
  46. Else
  47.  
  48. MessageBox( Textmerge( "An error occurred in SMS. Status <<loXmlHttp.STATUS>> (<<loXmlHttp.statustext>>)." ) )
  49.  
  50. Endif
  51.  
  52. NexmoKey = '1b37ecc8'
  53. NexmoSecret = 'df183c07'
  54. NexmoNumber = 'AMA Motors'
  55.  
  56. mob = '39829374'
  57. mmessage = 'Hi'
  58. MMOB = '00973'+ALLTRIM(m.mob )
  59.  
  60.  
  61. to = m.mmob
  62. lcMessage = m.mmessage
  63.  
  64. nexmoURL = Textmerge(;
  65. "https://rest.nexmo.com/sms/xml?"+;
  66. "username=<< m.NexmoKey >>|"+;
  67. "password=<< m.NexmoSecret >>|"+;
  68. "from=<< m.NexmoNumber >>")
  69.  
  70. TrySendTTS(m.to,m.lcMessage, m.NexmoUrl)
  71.  
  72. Procedure TrySendTTS(tcPhone,tcMessage, tcNexmoUrl)
  73. tcMessage = Strtran(m.tcMessage, '%0A', '%0D%0A')
  74. lcUrl = Chrtran(;
  75. Textmerge("<< m.tcNexmoUrl >>|to=<< m.tcPhone >>|text=<< m.tcMessage >>"), '|', Chr(38))
  76.  
  77. Local loXmlHttp As "Microsoft.XMLHTTP"
  78. loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
  79.  
  80. loXmlHttp.Open( "POST" , m.lcUrl, .F. )
  81. * loXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
  82. loXmlHttp.Send( )
  83.  
  84. ? loXmlHttp.Status = 200
  85. ? loXmlHttp.responsetext
  86.  
  87. Endproc
  88.  
  89. <?xml version='1.0' encoding='UTF-8' ?>
  90. <mt-submission-response>
  91. <messages count='1'>
  92. <message>
  93. <to>97339829374</to>
  94. <messageId>0B00000044C5B1ED</messageId>
  95. <status>0</status>
  96. <remainingBalance>6.23650000</remainingBalance>
  97. <messagePrice>0.01740000</messagePrice>
  98. <network>42601</network>
  99. </message>
  100. </messages>
  101. </mt-submission-response>
Add Comment
Please, Sign In to add comment