Secure Login
Coldfusion

We offer code samples to make it easy for you to plug in SMS functionality into your applications.

Download our SDK containing sample projects in many languages or go straight to the language you need with our code samples.

<cfset sms="http://www.2sms.com/xml/xml.jsp"/>
<cfxml variable="req" caseSensitive="yes">
<Request xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance Xsi:noNamespaceSchemaLocation=http://schema.2sms.com/1.0/0410_RequestSendMessage.xsd Version="1.0">
  <Identification>
   <UserID>user@2sms.com</UserID>
   <Password>password</Password>
 </Identification>
 <Service>
  <ServiceName>SendMessage</ServiceName>
   <ServiceDetail>
    <BulkMessage>
     <DestinationList>
      <Destination>555-123-4567</Destination>
      <Destination>555-765-4321</Destination>
    </DestinationList>
    <Text><![The text of my message]]></Text>
   </BulkMessage>
  </ServiceDetail>
 </Service>
</Request>
</cfxml>
<cfhttp url="#sms#"method="post">
 <cfhttpparam type="header" name="Accept-Encoding" value=deflate;q=0"/>
 <cfhttpparam type="xml" value="#req#"/>
</cfhttp>
<cfset resp=XmlP****(cfhttp.fileContent)/>
<cfset list=XmlSearch(resp, "//ErrorCode")/>
<cfif list[1].xmlText Is "00">
 <cfset list=XmlSearch(resp, "//Response")/>
<cfelse>
 <cfset list=XmlSearch(resp, "//ErrorReason")/>
</cfif>
<cfoutput>#list[1].xmlText#</cfoutput>
©2sms Business Text Messaging,2018