Platforms to show: All Mac Windows Linux Cross-Platform
/CURL/WebServices/CURL post Twilio Verification - iOS
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/WebServices/CURL post Twilio Verification - iOS
This example is the version from Fri, 2nd Feb 2023.
Project "CURL post Twilio Verification - iOS.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class Screen1 Inherits MobileScreen
Control Result Inherits MobileTextArea
ControlInstance Result Inherits MobileTextArea
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control PB_Send Inherits MobileButton
ControlInstance PB_Send Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
SendCode
End EventHandler
End Control
Control TF_Code Inherits MobileTextField
ControlInstance TF_Code Inherits MobileTextField
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub TextChanged()
if me.Text.Length > 0 then
PB_Verify.Enabled = True
else
PB_Verify.Enabled = False
end if
End EventHandler
End Control
Control PB_Verify Inherits MobileButton
ControlInstance PB_Verify Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
SendVerification
End EventHandler
End Control
Control TF_PhoneNumber Inherits MobileTextField
ControlInstance TF_PhoneNumber Inherits MobileTextField
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub TextChanged()
if me.Text.Length > 0 then
PB_Send.Enabled = True
else
PB_Send.Enabled = False
end if
End EventHandler
End Control
Control TF_Service_SID Inherits MobileTextField
ControlInstance TF_Service_SID Inherits MobileTextField
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Label1 Inherits MobileLabel
ControlInstance Label1 Inherits MobileLabel
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Label2 Inherits MobileLabel
ControlInstance Label2 Inherits MobileLabel
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control TF_Account_SID Inherits MobileTextField
ControlInstance TF_Account_SID Inherits MobileTextField
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Label3 Inherits MobileLabel
ControlInstance Label3 Inherits MobileLabel
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control TF_AccountPass Inherits MobileTextField
ControlInstance TF_AccountPass Inherits MobileTextField
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Separator1 Inherits MobileSeparator
ControlInstance Separator1 Inherits MobileSeparator
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Separator2 Inherits MobileSeparator
ControlInstance Separator2 Inherits MobileSeparator
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Private Sub SendCode()
Dim e As Integer
dim d as new CURLSMBS
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
Result.text = d.OutputData.ReplaceLineEndings(EndOfLine)
End Sub
Private Sub SendVerification()
Dim e As Integer
dim d as new CURLSMBS
d.OptionURL = "https://verify.twilio.com/v2/Services/"+TF_Service_SID.Text+"/VerificationCheck"
d.OptionVerbose = True
d.CollectOutputData = True
d.OptionPost = 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)+"&Code="+EncodeURLComponent(TF_Code.Text)
e=d.Perform
Result.Text = d.OutputData.ReplaceLineEndings(EndOfLine)
dim dd As new JSONItem(d.OutputData)
Dim result As Boolean = dd.lookup("valid", False)
if result = True Then
MessageBox "Code verified"
Else
MessageBox "Code couldn't be verified"
end if
End Sub
End Class
Class LaunchScreen Inherits iosView
End Class
End Project
See also:
The items on this page are in the following plugins: MBS CURL Plugin.