Bulk SMS API ASP Help

 

Using standard ASP libraries

<%
url=”http://www.textmarketer.biz/gateway/?username=#&password=#&number=#&message=msg&orig=nameORnumber&option=xml”

Set objXMLDoc = CreateObject(”Microsoft.XMLDOM”)

objXMLDoc.async = False
objXMLDoc.load(url)

status = objXMLDoc.documentElement.selectSingleNode(”//response”).getAttribute(”status”)

if status = “success”  then
response.write “Status ” & status & ” Credits ” & objXMLDoc.documentElement.selectSingleNode(”//response/credits”).Text
else
response.write “Status ” & status & ” Reason ” & objXMLDoc.documentElement.selectSingleNode(”//response/reason”).Text
end if
%>

Put that into an ASP page and change the username, password, message and orig in the url string and it will work.  In terms of parsing the XML, this is a useful reference: http://devguru.com/technologies/xmldom/quickref/xmldom_methods.html.  This code does not use the .net framework so it will work in both ASP and ASP.NET pages.  The only weakness in the solution above is the fact that there can be multiple reasons for failure, this solution will only take the first reason, but for some, this will be good enough.  To make the code handle this case, the else block would need a loop and you would use objXMLDoc.documentElement.selectNodes instead of objXMLDoc.documentElement.selectSingleNode.

Popularity: 7%

  • Share/Bookmark

 

Discussion

What do you think? Leave a comment. Alternatively, write a post on your own weblog; this blog accepts trackbacks [trackback url].

Mentions on other sites...
  1. SMS API Gateway Spec :: Text Marketer Blog - Bulk SMS, Business SMS, SMS Gateway on June 26th, 2009 at 11:08 am:
Leave a Reply