This sample demonstrates how to send a message from the web.
Files used in this sample are located in the folder:
C:\Program Files\CodeSegment\SMS Studio\Samples\InfoService\WebSend
How to run this sample
Source code
The contents of the send_sms.asp file:
<%
'-------------------------------------------------------------------------------------------------------------------------------
' This script demonstrates how to send a message from the web using Info Service Named Pipe.
' After this script is executed a message will appear in the Outbox window.
' WARNING: Error checking omitted for clarity.
' However, the remote computer will get the Ok response only after successful reception of a message.
'-------------------------------------------------------------------------------------------------------------------------------
AllowedIP = "127.0.0.1" ' Put the IP address of the remote computer allowed to send you messages
RemoteIP = Request.ServerVariables("REMOTE_ADDR") ' Take the address of the remote computer which tries to send you this message
RemoteIP = AllowedIP ' Delete or comment this line to enable the simple IP check
if RemoteIP = AllowedIP then
MsgText = Request("msg")
Sender = Request("from")
Recipient = Request("to")
PipeName = "WebSendPipe" ' Name of the pipe. This value must be specified in the Info Setup dialog
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set pipe = fso.CreateTextFile("\\.\pipe\" & PipeName) ' Open the pipe instance
pipe.WriteLine("From: " & Sender)
pipe.WriteLine("To: " & Recipient)
pipe.WriteLine("Body: " & MsgText)
pipe.WriteLine("<Send>") ' Send the message
pipe.Close ' Close the pipe instance
response.write("Ok") ' This line will not be executed in case of the failure
else
response.write("Not allowed.") ' Our simple IP check detected not allowed access
end if
'-------------------------------------------------------------------------------------------------------------------------------
' Copyright (c) 2002-2009 CodeSegment. All rights reserved. http://www.codesegment.com/
'-------------------------------------------------------------------------------------------------------------------------------
%>
| Copyright © 2002-2010 CodeSegment. All rights reserved. |