ASP. Twilio

Source: Internet
Author: User

Imports system.netimports system.textimports twiliopublic Class clstwiliosms public Shared Function Send (ByVal Ptonumbe R As String, ByVal Psmsmessage as String) As String Dim strreturn As String = "0" Dim strlog As String = Now . ToString ("Yyyy-mm-dd HH:mm:ss") & "Send Sms to" & Ptonumber & Vblet Try Dim Accountsid as string = My.MySettings.Default.SMSAccountSid.ToString Dim AuthToken as String = My.MySettings.Default.SMSAuthTo Ken. ToString Dim fromnumber As String = My.MySettings.Default.SMSFromNumber.ToString Dim Twilio As Twili Orestclient = New twiliorestclient (accountsid, AuthToken) Dim message as Smsmessage = Twilio.sendsmsmessage (Fro Mnumber, Ptonumber, Psmsmessage, "") If (message. Sid is Nothing) then strlog + = ">>>send Sms Failed, Detail:" & message. Restexception.tostring Strreturn = "-1" Else strlog + = "; >>send Sms Success, Sid: "& message. Sid & Vblet Strreturn = "1" End If Catch ex as Exception strlog + = ">& Gt;>send Sms Exception, Detail: "& Ex.    ToString & Vblet Finally logbyline (strlog) End Try Return strreturn End Function                Private Shared Sub logbyline (ByVal pLine as String) Try If Trim (pLine) <> "Then Dim p12file As String = "SMSLog.txt" Dim p12filename As String = System.IO.Path.Combine (System.Web.Hosting. Hostingenvironment.mappath ("~/"), P12file) Dim aa as System.IO.StreamWriter = New System.IO.StreamWriter (p1 2Filename, True, System.Text.Encoding.UTF8) AA. WriteLine (pLine) AA. Close () AA. Dispose () End If Catch ex as Exception end Try End SubEnd Class

The main DLLs:

Http://files.cnblogs.com/files/xiaobuild/TwilioDLL.zip

Reference website:

Https://www.twilio.com/user/account/developer-tools/api-explorer/message-create

ASP. Twilio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.