Created
June 10, 2020 17:30
-
-
Save sadik-fattah/b9d435b191fcac44280370141cec865e to your computer and use it in GitHub Desktop.
senfing sms from Clockwork
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports Clockwork | |
Imports System.Net | |
Public Class Form1 | |
Private Sub BTNsend_Click(sender As Object, e As EventArgs) Handles BTNsend.Click | |
If Textphone.Text & TextMessage.Text & TextKey.Text = "" Then | |
MessageBox.Show("راك خليت المستطيلات خاويين") | |
End If | |
Try | |
Dim api As Clockwork.API = New Clockwork.API(TextKey.Text) | |
Dim sms As Clockwork.SMS = New Clockwork.SMS() | |
sms.To = Textphone.Text | |
sms.Message = TextMessage.Text | |
Dim result As SMSResult = api.Send(sms) | |
If (result.Success) Then | |
MessageBox.Show("Sent - ID: " + result.ID) | |
Else | |
MessageBox.Show("Error: " + result.ErrorMessage) | |
End If | |
Catch ex As Exception | |
' You'll get an API exception for errors | |
' such as wrong key | |
MessageBox.Show("API Exception: " + ex.Message) | |
' Catch ex As WebException | |
'Web exceptions mean you couldn't reach the mediaburst server | |
' MessageBox.Show("Web Exception: " + ex.Message) | |
' Catch ex As ArgumentException | |
' Argument exceptions are thrown for missing parameters, | |
' such as forgetting to set the username | |
' MessageBox.Show("Argument Exception: " + ex.Message) | |
' Catch ex As Exception | |
' Something else went wrong, the error message should help | |
' MessageBox.Show("Unknown Exception: " + ex.Message) | |
End Try | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment