'VB6 SMS API integration code

Private Sub Command1_Click()
    Dim DataToSend As String
    Dim objXML As Object
    Dim apikey As String
    Dim senderid As String
    Dim channel As String
    Dim DCS As String
    Dim flashsms As String
    Dim number As String
    Dim message As String
    Dim route As String
    Dim URL As String

'Set these variables
//Your authentication key
apikey = "Your Apikey";
//Approved sender id(6 characters string only).
senderid = "TESTIN";
//Message channel Promotional=1 or Transactional=2.
channel = "2";
//Default is 0 for normal message, Set 8 for unicode sms.
flashsms = "0";
//Default is 0 for normal sms, Set 1 for immediate display.
number = "9999999999";
//Recipient mobile number (pass with comma seprated if need to send on more then one number). message = "TEST MESSAGE";
//Define route
route = "DEFAULT";
' this url encode function may not work fully functional. message = URLEncode(" Your message ")
'Define route route = "default" ' do not use https URL = "https://www.smsgatewayhub.com/api/mt/SendSMS?"
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