System Management Server(SMS) & ASP

How to use asp to control a SMS and send a SMS message to mobile phone use, what program i need, and please give me a simple code to try it, thanx!
LVL 7
weesiongAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TensionCommented:

Hi weesiong

   actually the prgm. is written VB...
 
first u have to register in sms-wap.com to u r userid.  

    use these controls in u r form ...

winsock, and two text boxes, one for sending the message and the other for typing the mobile no. and two command button BtnSend and BtnExit..

Here winsock is named as Inet, the text entered for message name as Message and the textbox entered for the Mobile no is named as Numlist.

'****************************************' This example demonstrates how to submit a SMS message to the
' NovelSoft SMSC from a Visual Basic program

************************************************************

' PUT YOUR OWN SMS USERNAME AND PASSWORD HERE
Const USERNAME = "test1234"
Const PASSWORD = "test3456"
Const TEST = 1  ' For debugging purposes only

Dim buffer As String


' Terminate the application
'
Private Sub BtnExit_Click()
    ' Terminate the application
    End
End Sub


' Send a message!
'
Private Sub BtnSend_Click()
    Dim query As String, headers As String
    Dim qlen As Integer
    Dim msg As String, c As String
    Dim res As Integer
    Dim i As Integer
   
    ' Convert special characters in the message text
    msg = ""
    For i = 1 To Len(Message.Text)
        c = Mid(Message.Text, i, 1)
        Select Case c
            Case "&": c = "%26"
            Case "+": c = "%2B"
            Case "%": c = "%25"
            Case "#": c = "%23"
            Case "=": c = "%3D"
            Case " ": c = "%20"
        End Select
        msg = msg + c
    Next
   
    ' Construct the HTTP query string
    query = "UID=" & USERNAME _
            & "&PW=" & PASSWORD _
            & "&TEST=" & TEST _
            & "&NUMLIST=" & Numlist.Text _
            & "&MSG=" & msg
    qlen = Len(query)
   
    res = MsgBox(query & vbCrLf & "(Length: " & qlen & ")", vbOKCancel, "Query String:")
    If res = vbOK Then
   
        ' Connect to the server
        buffer = ""
        Inet.RemoteHost = "www.sms-wap.com": Inet.RemotePort = 80: Inet.Connect
        While (Inet.State <> sckConnected) And (Inet.State <> sckError): DoEvents: Wend
       
        If Inet.State = sckConnected Then
            ' Transmit the request to the server via Execute()
            headers = "Host: www.sms-wap.com" & vbCrLf _
                        & "Content-length: " & qlen & vbCrLf _
                        & "Content-type: application/x-www-form-urlencoded"
   
            Inet.SendData "POST /cgi/csend.cgi HTTP/1.0" & vbCrLf _
                            & headers & vbCrLf & vbCrLf _
                            & query
            While (Inet.State = sckConnected): DoEvents: Wend
            Inet.Close
           
            ' Get response code and strip HTTP header
            i = InStr(1, buffer, vbCrLf & vbCrLf)
            If i > 0 Then buffer = Mid(buffer, i + 4)
            MsgBox "The server response was: " & buffer
        Else
            MsgBox "Could not connect to server"
        End If
    End If
End Sub


' This routine is called by the Internet Control during transfer. We use it
' to gather the response code.
'
Private Sub Inet_DataArrival(ByVal n As Long)
    Dim s As String
   
    s = ""
    Inet.GetData s, vbString
    buffer = buffer + s
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TensionCommented:

Hi weesiong

   actually the prgm. is written VB...
 
first u have to register in sms-wap.com to u r userid.  

    use these controls in u r form ...

winsock, and two text boxes, one for sending the message and the other for typing the mobile no. and two command button BtnSend and BtnExit..

Here winsock is named as Inet, the text entered for message name as Message and the textbox entered for the Mobile no is named as Numlist.

'****************************************' This example demonstrates how to submit a SMS message to the
' NovelSoft SMSC from a Visual Basic program

************************************************************

' PUT YOUR OWN SMS USERNAME AND PASSWORD HERE
Const USERNAME = "test1234"
Const PASSWORD = "test3456"
Const TEST = 1  ' For debugging purposes only

Dim buffer As String


' Terminate the application
'
Private Sub BtnExit_Click()
    ' Terminate the application
    End
End Sub


' Send a message!
'
Private Sub BtnSend_Click()
    Dim query As String, headers As String
    Dim qlen As Integer
    Dim msg As String, c As String
    Dim res As Integer
    Dim i As Integer
   
    ' Convert special characters in the message text
    msg = ""
    For i = 1 To Len(Message.Text)
        c = Mid(Message.Text, i, 1)
        Select Case c
            Case "&": c = "%26"
            Case "+": c = "%2B"
            Case "%": c = "%25"
            Case "#": c = "%23"
            Case "=": c = "%3D"
            Case " ": c = "%20"
        End Select
        msg = msg + c
    Next
   
    ' Construct the HTTP query string
    query = "UID=" & USERNAME _
            & "&PW=" & PASSWORD _
            & "&TEST=" & TEST _
            & "&NUMLIST=" & Numlist.Text _
            & "&MSG=" & msg
    qlen = Len(query)
   
    res = MsgBox(query & vbCrLf & "(Length: " & qlen & ")", vbOKCancel, "Query String:")
    If res = vbOK Then
   
        ' Connect to the server
        buffer = ""
        Inet.RemoteHost = "www.sms-wap.com": Inet.RemotePort = 80: Inet.Connect
        While (Inet.State <> sckConnected) And (Inet.State <> sckError): DoEvents: Wend
       
        If Inet.State = sckConnected Then
            ' Transmit the request to the server via Execute()
            headers = "Host: www.sms-wap.com" & vbCrLf _
                        & "Content-length: " & qlen & vbCrLf _
                        & "Content-type: application/x-www-form-urlencoded"
   
            Inet.SendData "POST /cgi/csend.cgi HTTP/1.0" & vbCrLf _
                            & headers & vbCrLf & vbCrLf _
                            & query
            While (Inet.State = sckConnected): DoEvents: Wend
            Inet.Close
           
            ' Get response code and strip HTTP header
            i = InStr(1, buffer, vbCrLf & vbCrLf)
            If i > 0 Then buffer = Mid(buffer, i + 4)
            MsgBox "The server response was: " & buffer
        Else
            MsgBox "Could not connect to server"
        End If
    End If
End Sub


' This routine is called by the Internet Control during transfer. We use it
' to gather the response code.
'
Private Sub Inet_DataArrival(ByVal n As Long)
    Dim s As String
   
    s = ""
    Inet.GetData s, vbString
    buffer = buffer + s
End Sub
weesiongAuthor Commented:
Thank you for your comment, but i still got some problem

1) I canot register a new account in the www.sms-wap.com, because my mobile phone canot received the login name and password from the server after i register it

2) In my country also have a website as like www.sms-wap.com let the use send a sms message to mobile phone(for my country malaysia only). In also same, register 1st, and after it, u can goto send a sms message but just 15msg per-day. But now i hope i can use what the vb program u give me to send a message to other mobile phone use, but it no succefully, and this is my code;

Const USERNAME = "9732031"
Const PASSWORD = "weesiong"
Const TEST = 1  ' For debugging purposes only

Dim buffer As String


' Terminate the application
'
Private Sub BtnExit_Click()
    ' Terminate the application
    End
End Sub


' Send a message!
'
Private Sub BtnSend_Click()
    Dim query As String, headers As String
    Dim qlen As Integer
    Dim msg As String, c As String
    Dim res As Integer
    Dim i As Integer
     
    ' Convert special characters in the message text
    msg = ""
    For i = 1 To Len(message.Text)
        c = Mid(message.Text, i, 1)
        Select Case c
            Case "&": c = "%26"
            Case "+": c = "%2B"
            Case "%": c = "%25"
            Case "#": c = "%23"
            Case "=": c = "%3D"
            Case " ": c = "%20"
        End Select
        msg = msg + c
    Next
     
    ' Construct the HTTP query string
    'query = "UID=" & USERNAME _
    '        & "&PW=" & PASSWORD _
    '        & "&TEST=" & TEST _
    '        & "&NUMLIST=" & numlist.Text _
    '        & "&MSG=" & msg
    query = "session_key=798678929" _
            & "&function=confirmSend" _
            & "&telephone=" & numlist.Text _
            & "&username=9732031" _
            & "&message=" & msg _
            & "&phonebookname="
           
    qlen = Len(query)
     
    res = MsgBox(query & vbCrLf & "(Length: " & qlen & ")", vbOKCancel, "Query String:")
    If res = vbOK Then
     
        ' Connect to the server
        buffer = ""
        Inet.RemoteHost = "sms.catcha.com.my": Inet.RemotePort = 80: Inet.Connect
        While (Inet.State <> sckConnected) And (Inet.State <> sckError): DoEvents: Wend
         
        If Inet.State = sckConnected Then
            ' Transmit the request to the server via Execute()
            headers = "Host: sms.catcha.com.my" & vbCrLf _
                        & "Content-length: " & qlen & vbCrLf _
                        & "Content-type: application/x-www-form-urlencoded"
     
            Inet.SendData "POST cgi-bin/4-4.cgi HTTP/1.0" & vbCrLf _
                            & headers & vbCrLf & vbCrLf _
                            & query
            While (Inet.State = sckConnected): DoEvents: Wend
            Inet.Close
             
            ' Get response code and strip HTTP header
            i = InStr(1, buffer, vbCrLf & vbCrLf)
            If i > 0 Then buffer = Mid(buffer, i + 4)
            MsgBox "The server response was: " & buffer
        Else
            MsgBox "Could not connect to server"
        End If
    End If
End Sub


' This routine is called by the Internet Control during transfer. We use it
' to gather the response code.
'
Private Sub Inet_DataArrival(ByVal n As Long)
    Dim s As String
     
    s = ""
    Inet.GetData s, vbString
    buffer = buffer + s
End Sub

CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

weesiongAuthor Commented:
Thank you for your comment, but i still got some problem

1) I canot register a new account in the www.sms-wap.com, because my mobile phone canot received the login name and password from the server after i register it

2) In my country also have a website as like www.sms-wap.com let the use send a sms message to mobile phone(for my country malaysia only). In also same, register 1st, and after it, u can goto send a sms message but just 15msg per-day. But now i hope i can use what the vb program u give me to send a message to other mobile phone use, but it no succefully, and this is my code;

Const USERNAME = "9732031"
Const PASSWORD = "weesiong"
Const TEST = 1  ' For debugging purposes only

Dim buffer As String


' Terminate the application
'
Private Sub BtnExit_Click()
    ' Terminate the application
    End
End Sub


' Send a message!
'
Private Sub BtnSend_Click()
    Dim query As String, headers As String
    Dim qlen As Integer
    Dim msg As String, c As String
    Dim res As Integer
    Dim i As Integer
     
    ' Convert special characters in the message text
    msg = ""
    For i = 1 To Len(message.Text)
        c = Mid(message.Text, i, 1)
        Select Case c
            Case "&": c = "%26"
            Case "+": c = "%2B"
            Case "%": c = "%25"
            Case "#": c = "%23"
            Case "=": c = "%3D"
            Case " ": c = "%20"
        End Select
        msg = msg + c
    Next
     
    ' Construct the HTTP query string
    'query = "UID=" & USERNAME _
    '        & "&PW=" & PASSWORD _
    '        & "&TEST=" & TEST _
    '        & "&NUMLIST=" & numlist.Text _
    '        & "&MSG=" & msg
    query = "session_key=798678929" _
            & "&function=confirmSend" _
            & "&telephone=" & numlist.Text _
            & "&username=9732031" _
            & "&message=" & msg _
            & "&phonebookname="
           
    qlen = Len(query)
     
    res = MsgBox(query & vbCrLf & "(Length: " & qlen & ")", vbOKCancel, "Query String:")
    If res = vbOK Then
     
        ' Connect to the server
        buffer = ""
        Inet.RemoteHost = "sms.catcha.com.my": Inet.RemotePort = 80: Inet.Connect
        While (Inet.State <> sckConnected) And (Inet.State <> sckError): DoEvents: Wend
         
        If Inet.State = sckConnected Then
            ' Transmit the request to the server via Execute()
            headers = "Host: sms.catcha.com.my" & vbCrLf _
                        & "Content-length: " & qlen & vbCrLf _
                        & "Content-type: application/x-www-form-urlencoded"
     
            Inet.SendData "POST cgi-bin/4-4.cgi HTTP/1.0" & vbCrLf _
                            & headers & vbCrLf & vbCrLf _
                            & query
            While (Inet.State = sckConnected): DoEvents: Wend
            Inet.Close
             
            ' Get response code and strip HTTP header
            i = InStr(1, buffer, vbCrLf & vbCrLf)
            If i > 0 Then buffer = Mid(buffer, i + 4)
            MsgBox "The server response was: " & buffer
        Else
            MsgBox "Could not connect to server"
        End If
    End If
End Sub


' This routine is called by the Internet Control during transfer. We use it
' to gather the response code.
'
Private Sub Inet_DataArrival(ByVal n As Long)
    Dim s As String
     
    s = ""
    Inet.GetData s, vbString
    buffer = buffer + s
End Sub

Can you tell me why i have got his error ;
The server response was: <!DOCTYPE HTML PUBLIC" -//IETF//DTD HTML 2.0??EN">
<HTNL><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understabd.<P>
Invalie URl in request POST cgi-bin/4-4.cgi HTTP/1.0<P>
<HR>
<ADDRESS>Apache/1.3.11 Server at melissa,catcha.com Port 80</ADDRESS>
</BODY></HTML>

HencahCommented:
hmm this is very interesting. I wonder I could know how to implement that using asp like www.mtnsms.com did.
weesiongAuthor Commented:
i hope i can write a sms(short message service) with asp, are you have any comment? If i dont want use www.sms-wap.com server, what software i need? and i hope i can use modem to send the sms. what i need to setting and how to write a simple asp script? Thanx!
weesiongAuthor Commented:
Adjusted points from 100 to 120
kannaramaCommented:
hi weesiong.

yes ofcourse you can do write program which acts like a server(for eg: www.sms-wap.com), what you need is a SMS gateway for that.

you can download the gateway from www.winsms.com for free.

once you have downloaded it, Contact your local mobile phone service providers and get their unique id from them, which is more or like an IP address. once you have try sending messege through your ASP page or with the VB program provided in the sms-wap.com.

But www.sms-wap.com charges for each messege you send. So setting up your own gateway and sending messeges would be a better idea.

Once you are all set. please do inform me.


regards

kannan


kannaramaCommented:
Rather than routing from sms-wap.com you can have your own gateway registered and route the messege transfer. So you dont have to pay heavily as for using sms-wap.com
weesiongAuthor Commented:
although no is a asp i want, but i have learn more about sms. Thanx!
ctlimCommented:
hello weesiong, please give me a contact email to me, mine is damonlim@viztel.com
I would like to talk to you further.
weesiongAuthor Commented:
sure you can, my email@address is weesiong@rocketmai.com ; i also come from Malaysia~@@~
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.