Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/WebServices/CURL post Twilio Verification


Required plugins for this example: MBS CURL Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/WebServices/CURL post Twilio Verification

This example is the version from Fri, 2nd Feb 2023.

Project "CURL post Twilio Verification.xojo_binary_project"
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control PB_Send Inherits PushButton
ControlInstance PB_Send Inherits PushButton
EventHandler Sub Action() SendCode End EventHandler
End Control
Control Result Inherits TextArea
ControlInstance Result Inherits TextArea
End Control
Control TF_Service_SID Inherits TextField
ControlInstance TF_Service_SID Inherits TextField
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control TF_Account_SID Inherits TextField
ControlInstance TF_Account_SID Inherits TextField
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control TF_AccountPass Inherits TextField
ControlInstance TF_AccountPass Inherits TextField
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control TF_Code Inherits TextField
ControlInstance TF_Code Inherits TextField
EventHandler Sub TextChange() if me.Text.LenB>0 then PB_Verify.Enabled = True else PB_Verify.Enabled = False end if End EventHandler
End Control
Control PB_Verify Inherits PushButton
ControlInstance PB_Verify Inherits PushButton
EventHandler Sub Action() SendVerification End EventHandler
End Control
Control TF_PhoneNumber Inherits TextField
ControlInstance TF_PhoneNumber Inherits TextField
EventHandler Sub TextChange() if me.Text.LenB>0 then PB_Send.Enabled = True else PB_Send.Enabled = False end if End EventHandler
End Control
Private Sub SendCode() Dim e As Integer dim d as new TwilioCURL d.OptionURL = "https://verify.twilio.com/v2/Services/"+TF_Service_SID.Text+"/Verifications" d.OptionVerbose = True d.CollectOutputData = True d.OptionUsername = TF_Account_SID.Text d.OptionPassword = TF_AccountPass.Text d.SetOptionHTTPHeader Array("Content-Type: application/x-www-form-urlencoded") d.OptionPostFields = "To="+EncodeURLComponent(TF_PhoneNumber.Text)+"&Channel=sms" e=d.Perform ListBox1.AddRow "Result: "+str(e) ListBox1.AddRow d.GetInfoContentType Result.text = ReplaceLineEndings(d.OutputData,EndOfLine) End Sub
Private Sub SendVerification() Dim e As Integer dim d as new TwilioCURL d.OptionURL = "https://verify.twilio.com/v2/Services/"+TF_Service_SID.Text+"/VerificationCheck" d.OptionVerbose = True d.CollectOutputData = True d.OptionUsername = TF_Account_SID.Text d.OptionPassword = TF_AccountPass.Text d.SetOptionHTTPHeader Array("Content-Type: application/x-www-form-urlencoded") d.OptionPostFields = "To="+EncodeURLComponent(TF_PhoneNumber.Text)+"&Channel=sms&"+"Code="+EncodeURLComponent(TF_Code.Text) e=d.Perform ListBox1.AddRow "Result: "+str(e) ListBox1.AddRow d.GetInfoContentType Result.text = ReplaceLineEndings(d.OutputData,EndOfLine) dim dd As new JSONItem(d.OutputData) Dim result As Boolean = dd.lookup("valid", False) if result = True Then MsgBox "Code verified" Else MsgBox "Code couldn't be verified" end if End Sub
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
End Class
Class TwilioCURL Inherits CURLSMBS
EventHandler Sub DebugMessage(infotype as integer, data as string, dataSize as Integer) System.DebugLog str(infotype) System.DebugLog data End EventHandler
Sub Constructor() End Sub
End Class
End Project

See also:

The items on this page are in the following plugins: MBS CURL Plugin.


The biggest plugin in space...