<% '------------------------------------------------------------------------------------------- ' ASP SCRIPT FOR SMS GATEWAY ' (c) 2001-2009 Digitel Mobile Srl ' all rights reserved ' last update: 20 May 2009 ' Requires MSXML2 '------------------------------------------------------------------------------------------- ' +OK Credit SMS is accepted by SMS Server ' -ERR 100 Syntax/System Error ' -ERR 99 Credit Not Available ' -ERR 98 Login Failure ' -ERR 97 Gateway Error ' -ERR 96 Country Code Not Valid ' -ERR 95 Gsm Code Not Valid ' -ERR 94 Phone Number/Recipients Not Valid ' -ERR 93 SMS Data Not Valid ' -ERR 92 Data/Time Not Valid ' -ERR 91 Country Code or/and Gsm Code Not Available ' -ERR 90 Network Barred ' -ERR 89 Account Blocked ' -ERR 88 SMS Not Recognized ' -ERR 87 IP Address Blocked By Account ' -ERR 86 Recipient Blocked By Account ' -ERR 85 IP Address Not Authorized ' -ERR 84 Sender Not Valid ' -ERR 83 Bad Request myAccount = "xxxxxx" ' Mandatory, Max 20 Bytes, String, Username of customer account myPassword = "yyyyyyy" ' Mandatory, Max 20 Bytes, String, Password of customer account mySender = "testSMS" ' Mandatory, Max 14 Digits or 11 characters alpahnumeric Originator myRecipients = 2 ' Mandatory, Max 2 Digits, Integer: 1 to 99 Number of recipients myPhoneNumbers = "+39123456789,+44123456789" ' Mandatory, Max 1584 Bytes, String, List of one or several recipient phone number to receive the SMS (separated by commas) mySMSData = "This is a test message" ' Mandatory, Max 4096 Bytes, String, SMS Message mySMSType = "" ' Optional, Max 3 Bytes, String Type of message mySMSDateTime = "25-Dec-2009 02:00:00 PM" ' Optional, Max 30 Bytes, Date and Time for deferred delivery mySMSTest = 1 ' Optional, Boolean (1=True, 0=False), Indicates "test" mode myUDH = "" ' Optional, Max 400 Bytes, String, User Data Header myDCS = "" ' Optional, Max 2 Bytes, Hex, Data Coding Scheme myDeliveryRequest = 1 ' Optional, Max 1 Digit, Integer, Request for Delivery Report myNotification = "mailto:youremail@yourdomain.xxx" ' Optional, Max 98 Bytes, String, Allow to send notification to email address or to a script via Http mySmsValidity = "" ' Optional, Max 4 Digits, Numeric, Validity Period mySmsRef = "1000012345" ' Optional, Max 20 Bytes, String, Reference ID Account = EncodeUrl(myAccount) Password = EncodeUrl(myPassword) Sender = EncodeUrl(mySender) Recipients = EncodeUrl(myRecipients) PhoneNumbers = EncodeUrl(myPhoneNumbers) SMSData = EncodeUrl(mySMSData) SMSType = EncodeUrl(mySMSType) SMSDateTime = EncodeUrl(mySMSDateTime) SMSTest = EncodeUrl(mySMSTest) UDH = EncodeUrl(myUDH) DCS = EncodeUrl(myDCS) DeliveryRequest = EncodeUrl(myDeliveryRequest) Notification = EncodeUrl(myNotification) SmsValidity = EncodeUrl(mySmsValidity) SmsRef = EncodeUrl(mySmsRef) StringHttpPost = "" StringHttpPost = StringHttpPost & "Account=" & Account & "&Password=" & Password & "&SMSTest=" & SMSTest StringHttpPost = StringHttpPost & "&Sender=" & Sender & "&SMSData=" & SMSData & "&UDH=" & UDH StringHttpPost = StringHttpPost & "&Recipients=" & Recipients & "&PhoneNumbers=" & PhoneNumbers & "&SMSDateTime=" & SMSDateTime StringHttpPost = StringHttpPost & "&DeliveryRequest= " & DeliveryRequest & "&Notification=" & Notification StringHttpPost = StringHttpPost & "&SmsValidity= " & SmsValidity & "&SmsRef=" & SmsRef & "&SMSType=" & SMSType & "&DCS=" & DCS URL = "http://gateway.smsitaly.com/bulk/send.asp" Set XML = Server.CreateObject("MSXML2.ServerXMLHTTP") XML.Open "POST", URL, False XML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" XML.Send StringHttpPost Result = XML.responsetext Set XML = Nothing Response.write result Function EncodeUrl(stringUrl) StringOut = "" For X = 1 To Len(stringUrl) StringOut = StringOut & "%" & UCase(Right("00" & Hex(Asc(Mid(stringUrl, X, 1))), 2)) Next EncodeUrl = StringOut End Function %>