Solved

System Management Server(SMS) & ASP

Posted on 2000-05-10
12
447 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API not working 33 67
Adding Row and Cell on a table 14 25
Weighted Randomizing 6 30
XML and version of MS XML Dom Document versions 5 13
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 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