by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
ASP sample: send an SMS message through a Nokia mobile phone. Also works for Ericsson, Motorola and Siemens cellular phones that support the
' You need the freeware AComport.dll to run the sample.
' Download it from http://www.vahland.com/pub/acomport.dll
' and register it on your machine.
' Read http://www.vahland.com/pub/acomport.htm for more info
%>
Const acERR_SUCCESS = 0 ' Success
Const acERR_EVALUATIONEXPIRED = 1 ' Evaluation period has expired
Const acERR_INVALIDLICENSE = 2 ' License was entered, but invalid
Const acERR_GENERICERROR = 100 ' Generic Error
Const acERR_INVALIDPARAM = 101 ' Invalid parameter
Const acERR_INVALIDPORT = 102 ' Invalid port. Most probably, port does not exist or is in use
Const acERR_PORTALREADYOPENED = 103 ' Unable to perform operation because port it already opened
Const acERR_OPENPORTFAILED = 104 ' Generic open port error
Const acERR_INITIALIZEPORTFAILED = 105 ' Unable to initialize port
Const acERR_WRITEPORTFAILED = 106 ' Unable to write to port
Const acERR_WRITEPORTDIRECTFAILED = 107 ' Unable to write directly to port
Const acERR_READPORTFAILED = 108 ' Unable to read from port
Const acERR_GETCOMSTATEFAILED = 109 ' Unable to retrieve device information
Const acERR_SETCOMSTATEFAILED = 110 ' Unable to change device settings
Const acERR_PURGECOMFAILED = 111 ' Unable to purge the port
Const acERR_TIMEOUT = 112 ' Timeout
%>
<object runat=server progid="ActivXperts.ComPort" id=acObj> </object>
Sub WriteStr( o, str )
o.WriteString str
response.write(" Received:" &str & "<br>")
End Sub
%>
Function ReadStr( o )
strResult = ""
str = "notempty"
o.Sleep 200
Do While str <> ""
str = o.ReadString
If str <> "" Then
ReadStr = str
response.write("Sent:" &str & "<br>")
End If
Loop
End Function
%>
If Request( "BUTTON_SUBMIT" ) <> "" Then
acObj.PortID = Request( "NUM_PORTID" )
acObj.Open
If acObj.LastError = acERR_SUCCESS Then
STR_CMD1 = "AT+CMGF=1"
WriteStr acObj, STR_CMD1
str=readstr(acobj)
STR_CMD2 = "AT+CMGS=" + """" + Request( "STR_CMD2" ) + """"
WriteStr acObj, STR_CMD2
str=readstr(acobj)
If Request( "STR_CMD3" ) <> "" Then
WriteStr acObj, Request( "STR_CMD3" )
str=readstr(acobj)
str = chr(26)
acObj.WriteString(str)
str=readstr(acobj)
End If
acObj.Close
End If
%>
<html>
<body>
<hr>
<h1>SMS Application</h1>
<h2>Your message was sent successfully</h2>
</body>
</html>
Else
%>
<html>
<body>
<hr>
<h1>SMS Application</h1>
<hr>
<br>
<form action="sendsms.asp" method="post">
<table>
<tr>
<td width="100">Comport:</td>
<td>
<select size="1" name="NUM_PORTID">
<option selected>1</option> <option>2</option>
<option>3</option> <option>4</option>
</select>
</td>
</tr>
<td>Cellphone:</td><td><input size=15 type=text name="STR_CMD2" value=""></td>
</tr>
<tr>
<td>Message:</td><td><input type="text" name="STR_CMD3" value=""></td>
</tr>
</table>
<p><input type="submit" value="Send" name="BUTTON_SUBMIT"></p>
</form>
</body>
</html>
End If %>
No comments have been posted about ASP sample: send an SMS message through a Nokia mobile phone. Also works for Ericsson, Motorola and. Why not be the first to post a comment about ASP sample: send an SMS message through a Nokia mobile phone. Also works for Ericsson, Motorola and.