ViaNett provides you with example code and programming objects to help you connect
to our gateway using the programming language of your choice. You are welcome to
try these scripts. Sign up now to get 5 free
SMS.
What is ASP?
Microsoft® Active Server Pages (ASP) is a server-side scripting environment used
to create and run dynamic, interactive Web server applications. With ASP, you can
combine HTML pages, script commands and COM components to create interactive Web
pages and powerful Web-based applications that are easy to develop and modify.
Please visit the official
ASP homepage if you want to know more.
ASP example code
This example code uses a ready-made object, based on the
HTTP API. To use this script, simply
register for free and get 5 free SMS.
<!--#include file="ViaNettSMS.asp"-->
|
<% |
' Declare local variables.
|
Dim
Username, Password, MsgSender, DestinationAddress, Message
|
' Set value of variables.
|
Username =
"YourUsername"
|
Password = "YourPassword"
|
MsgSender =
"YourSender, example: a phone number like
4790000000" |
DestinationAddress = "Receiver - A phone
number" |
Message =
"Hello World!"
|
|
' Declare ViaNettSMSObj and SMSResult object.
|
Dim
ViaNettSMSObj, SMSResult |
' Set the ViaNettSMSObj object as type of
ViaNettSMS class in file ViaNettSMS.asp.
|
Set
ViaNettSMSObj = New
ViaNettSMS |
' Set username and password.
|
ViaNettSMSObj.SetUsernameAndPassword Username, Password |
' Try sending SMS, and fetch result.
|
Set
SMSResult = ViaNettSMSObj.SendSMS(MsgSender, DestinationAddress, Message)
|
' Check if SendSMS was successful.
|
If
SMSResult.Success Then
|
' SMS successfully sent.
|
Response.Write "SMS
successfully sent!"
|
Else
|
' SMS failed to send,
write ErrorCode and ErrorMessage.
|
Response.Write " Error occured. ErrorCode:
" & SMSResult.ErrorCode
|
Response.Write " ErrorMessage:
" & SMSResult.ErrorMessage
|
End
if |
%> |
"ViaNettSMS" ASP object
ViaNett provides you with an object/class in ASP, based on the
HTTP API. The source code is available for
download.
Download source code
You need to log in to download the source
code. Sign up now and get 5 free SMS messages.
Click here to download the source code.