vb6 Sample Code Send SMS

 In sample code

vb6 Sample Code Send SMS

Private Sub Command1_Click()

    Dim DataToSend As String
    Dim objXML As Object
    Dim message As String
    Dim authKey As String
    Dim mobiles As String
    Dim sender As String
    Dim route As String
    Dim URL As String

'Set these variables
authKey = "Your auth key";

mobiles  = "9999999999";

'Sender ID,While using route4 sender id should be 6 characters long.
sender = "TESTIN";

' this url encode function may not work fully functional.
message = URLEncode(" Your message ")

'Define route
route = "default"
' do not use https
URL = "http://priority.muzztech.in/api/sendhttp.php?"

Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL , False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

objXML.send "authkey=" + authKey + "&mobiles=" + mobiles + "&message=" + message + "&sender=" + sender + "&route=" + route

 If Len(objXML.responseText) > 0 Then
        MsgBox objXML.responseText

 End If

End Sub

Function URLEncode(ByVal Text As String) As String
    Dim i As Integer
    Dim acode As Integer
    Dim char As String

    URLEncode = Text

    For i = Len(URLEncode) To 1 Step -1
        acode = Asc(Mid$(URLEncode, i, 1))
        Select Case acode
            Case 48 To 57, 65 To 90, 97 To 122
                ' don't touch alphanumeric chars
            Case 32
                ' replace space with "+"
                Mid$(URLEncode, i, 1) = "+"
            Case Else
                ' replace punctuation chars with "%hex"
                URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
                    (URLEncode, i + 1)
        End Select
    Next

End Function
Recent Posts

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

0