Solved

System Management Server(SMS) & ASP

Posted on 2000-05-10
12
446 Views
Last Modified: 2008-10-12
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!
0
Comment
Question by:weesiong
  • 6
  • 2
  • 2
  • +2
12 Comments
 

Accepted Solution

by:
Tension earned 120 total points
ID: 2798852

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
0
 

Expert Comment

by:Tension
ID: 2798866

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
0
 
LVL 7

Author Comment

by:weesiong
ID: 2799117
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

0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 7

Author Comment

by:weesiong
ID: 2799135
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>

0
 
LVL 3

Expert Comment

by:Hencah
ID: 2799223
hmm this is very interesting. I wonder I could know how to implement that using asp like www.mtnsms.com did.
0
 
LVL 7

Author Comment

by:weesiong
ID: 2799502
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!
0
 
LVL 7

Author Comment

by:weesiong
ID: 2799504
Adjusted points from 100 to 120
0
 

Expert Comment

by:kannarama
ID: 2799618
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


0
 

Expert Comment

by:kannarama
ID: 2799636
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
0
 
LVL 7

Author Comment

by:weesiong
ID: 2824172
although no is a asp i want, but i have learn more about sms. Thanx!
0
 

Expert Comment

by:ctlim
ID: 3007550
hello weesiong, please give me a contact email to me, mine is damonlim@viztel.com
I would like to talk to you further.
0
 
LVL 7

Author Comment

by:weesiong
ID: 3009637
sure you can, my email@address is weesiong@rocketmai.com ; i also come from Malaysia~@@~
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Update function to validate checkbox is checked 4 76
Save ms data to server side. 19 44
One field not displaying content (ASP Classic) 8 25
Html Table looping 4 8
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question