How to Receive a Message from the Web through ODBC Connection
This sample demonstrates how receive a message from the web through ODBC connection.
Files used in this sample are located in the folder:
C:\Program Files\CodeSegment\SMS Studio\Samples\ODBCConnection
The contents of the receive_sms.asp file:
<%
AllowedIP = "127.0.0.1"
RemoteIP = Request.ServerVariables("REMOTE_ADDR")
RemoteIP = AllowedIP
if RemoteIP = AllowedIP then
MsgText = Replace(Request("msg"),"'","''")
Sender = Replace(Request("from"),"'","''")
Recipient = Replace(Request("to"),"'","''")
set database = Server.CreateObject("ADODB.Connection")
database.Open "SMS ODBC Database"
database.Execute "INSERT INTO Incoming (RefID, MsgText, MsgType, Sender, Recipient) VALUES (0,'" & MsgText & "',0,'" & Sender & "','" & Recipient & "')"
database.Close
response.write("Ok")
else
response.write("Not allowed.")
end if
%>
How to run this sample
- See How to Setup an ODBC Connection to setup an ODBC connection.
- Install a web server on your computer. See How to Setup a Web Server for detailed instructions.
- Copy the receive_sms.asp and test_receive_sms.htm files to a folder accessible by your web
server (e.g. C:\Inetpub\wwwroot\smsstudio).
- To test receiving on your computer, use the following link:
http://localhost/smsstudio/test_receive_sms.htm.
Fill in the fields and click the Submit
button. You should see the confirmation page in your browser. Check the Inbox window in SMS Studio to see that the message has arrived.
- To test receiving from a remote location, use the following link:
http://YOUR_DOMAIN_NAME_OR_IP_ADDRESS/smsstudio/test_receive_sms.htm
- You can now inform your client to send you messages by using the following syntax:
http://YOUR_DOMAIN_NAME_OR_IP_ADDRESS/smsstudio/receive_sms.asp?from=SENDER&to=RECIPIENT&msg=MESSAGE_TEXT
Related topics
ODBC Account