Category: | ASP, HTML, and XML |
Type: | Applications |
Difficulty: | Beginning |
Version Compatibility: | Visual Basic 6 |
This code has been viewed 39906 times.
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations:
Code:
<html>
<HEAD>
<BODY>
<p>Sending XML <br>
<%
'========================================================
'This code requires a user account with http://www.2sms.com
'Register now for a free no obligation trial of the service
'Simply call this method with the username and password you
'choose on the site and include a message and destination
'
'REQUIRES: Microsoft's XML Parser
'========================================================
'Insert your username and password (as used to log on to the website) here
UserName = "USN"
PassWord = "PWD"
Message = "Testing SMS"
Destination = "447788123123"
'sample of how to retrieves the message and number from a previous posting page
'Message = request.form("message")
'Destination = request.form("number")
'form up the first segment of XML
strfirstpart= "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?> " & _
"<Request xmlns:xsi=" & Chr(34) & "http://www.w3.org/2001/XMLSchema-instance" & Chr(34) & "
xsi:noNamespaceSchemaLocation=" & Chr(34) & "http://schema.2sms.com/1.0/0410_RequestSendMessage.xsd" & Chr(34) & " Version = " &
Chr(34) & "1.0" & Chr(34) & ">" & _
"<Identification>" & _
"<UserID><![CDATA[" & username & "]]></UserID>" & _
"<Password>" & password & "</Password>" & _
"</Identification>" & _
"<Service>" & _
"<ServiceName>SendMessage</ServiceName>" & _
"<ServiceDetail>"
'
'Form up the middle of the XML. To send multiple messages within one document insert
'multiple SingleMessage nodes (eg loop through the code below to add the strMidPart string
'several times). Your document may contain up to 500 SingleMessage nodes.
'
strMidPart = strMidPart +"<SingleMessage><Destination>" & Destination & "</Destination><Text><![CDATA[" & Message &
"]]></Text></SingleMessage>"
'form up the bottom of the xml document
strEndPart = "</ServiceDetail>" & _
"</Service>" & _
"</Request>"
'Concatonate all 3 strings to form complete xml document for sending
XMLstring = strFirstPart + StrMidPart + strEndPart
%>
outgoing XML
<textarea name="textfield" cols="50" rows="10"><%=XMLstring%>
No comments:
Post a Comment