Secure Login
ASP

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.

<%@ Language=VBScript %>
<%
' Save this file as an *.asp file in a location which is accessible by IIS,
' Then open a browser and navigate to this file.

' Setup information for the test
Message = "This is a test of the 2SMS XML GateWay"
Destination = "SMS_NUMBER"
UserName = "your.account@your.company" ' Username used to log into 2SMS website
PassWord = "password" ' Password used to log into 2SMS website

' Generate the XML - for different types of reports, sends, etc. see http://schema.2sms.com/
XMLstring = "<?xml version='1.0'?> " & _
"<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><![CDATA[" & username & "]]></UserID>" & _
  "<Password>" & password & "</Password>" & _
"</Identification>" & _
"<Service>" & _
  "<ServiceName>SendMessage</ServiceName>" & _
  "<ServiceDetail>" & _
  "<SingleMessage>" & _
    "<Destination>" & Destination & "</Destination>" & _
    "<Text><![CDATA[" & Message & "]]></Text>" & _
  "</SingleMessage>" & _
  "</ServiceDetail>" & _
"</Service>" & _
"</Request>"

'Modify this section to use alternate method if you cannot use serverXMLHTTP
set xmlrequest = server.CreateObject("MSXML2.ServerXMLHTTP")
'set xmlrequest = server.CreateObject("MSXML.XMLHTTPRequest")

'send the XML to 2SMS
xmlrequest.open "POST", "http://www.2sms.com/xml/xml.jsp", False
xmlrequest.setRequestHeader "content-type", "application/x-www-form-urlencoded"
xmlrequest.send XMLstring
%>
<html>
  <body>
    <br/>
    outgoing XML:
    <br/>
    <TEXTAREA name="textfield" rows= "20"cols="75"><%=XMLstring%></TEXTAREA>
    <br/>
    Response text:
    <br/>
    <TEXTAREA name="textfield" rows="20" cols="75"><%=xmlrequest.responsetext%></TEXTAREA>
    <br/>
    Status text: <%=xmlrequest.statustext%>
  </body>
</html>
©2sms Business Text Messaging,2018