Adobe COLDFUSION 9 Manual page 1309

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
The following example is an expansion of Example: Using the submit command in sendGatewayMessage function
discussed in
"The submit
command" on page 1300. It checks for a nonempty return value and displays the message
number returned by the SMS. This example uses the SMS gateway that is configured when ColdFusion is installed. If
you change the gateway specified in the
file specifies synchronous mode.
<h3>Sending SMS From a Web Page Example</h3>
<cfif IsDefined("form.oncethrough") is "Yes">
<cfif IsDefined("form.SMSMessage") is True AND form.SMSMessage is not "">
<h3>Sending a Text Message: </h3>
<cfoutput>#form.SMSMessage#</cfoutput><br><br>
<cfscript>
/* Create a structure that contains the message. */
msg = structNew();
msg.command = "submit";
msg.destAddress = "5551234";
msg.shortMessage = form.SMSMessage;
ret = sendGatewayMessage("SMS Menu App - 5551212", msg);
</cfscript>
</cfif>
<cfif isDefined("ret") AND ret NEQ "">
<h3>Text message sent</h3>
<cfoutput>The Message Id is: #ret#</cfoutput>
<br><br>
</cfif>
<hr noshade>
</cfif>
<!--- begin by calling the cfform tag --->
<cfform>
SMS Text Message: <cfinput type="Text" name="SMSMessage"
value="Sample text Message" required="No" maxlength="160">
<p><input type = "submit" name = "submit" value = "Submit">
<input type = "hidden" name = "oncethrough" value = "Yes">
</cfform>
Optional parameters for outgoing SMS
You can send vendor-specific optional parameters by way of ColdFusion SMS gateway.
To set the optional parameters, specify them using the
If the gateway receives optional parameters in a message, they are included in the data struct that is returned to the
listener CFC method named
The following code describes how to add optional parameters:
params=StructNew();
params["parameter"]=BinaryDecode("string","binaryencoding");
params["parameter"]=CharsetDecode("string, encoding");
outgoingSMS.optionalParameters=params;
: Vendor-specific optional parameter.
parameter
: See BinaryDecode in CFML Reference.
BinaryDecode
: See CharsetDecode in CFML Reference.
CharsetDecode
SendGatewayMessage
optionalparameter
under the
onIncomingMessage
Last updated 8/5/2010
function, make sure that your gateway's configuration
attribute.
key.
optionalParameters
1304

Advertisement

Table of Contents
loading

Table of Contents