Android Code Snippet Send SMS/MMS using Twilio Rest API

Pathrose

Member
Licensed User
Hi, I would like to incorporate an SMS sending functionality into my App. It's another service provider like Twilio. They have provided the sample API in various languages like python, java, etc. How to convert this to B4A code. Just attaching the sample in VBA provided by them...Please help
  1. Public Sub Send()
  2. Dim username As String
  3. Dim password As String
  4. Dim result As String
  5. Dim myURL As String
  6. Dim Sender As String
  7. Dim numbers As String
  8. Dim Message As String
  9. Dim postData As String
  10. Dim winHttpReq As Object
  11. apikey = "yourAPIkey"
  12. Sender = "TXTLCL"
  13. numbers = "918123456789"
  14. Message = "This is your message"
  15. Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
  16. myURL = "https://api.textlocal.in/send/?"
  17. postData = "apikey=" + apikey + "&message=" + Message + "&numbers=" + numbers + "&sender=" + Sender
  18. winHttpReq.Open "POST", myURL, False
  19. winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  20. winHttpReq.Send (postData)
  21. SendSMS = winHttpReq.responseText
  22. End Sub
 

DonManfred

Expert
Licensed User
Longtime User
1. You should ALWAYS start a new thread for any issue.
Posting to existing threads is a mistake.
2. Search for okhttputils2. This you have to use.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…