How to Send SMS With VB.net

This guide is a guide provided by our iSMS Malaysia Team. You will be given information on how to add SMS functionality to your website and how to send sms with VB.NET code. This method uses HTTP communication between the SMS Gateway and your website. To send and receive SMS messages from a webpage, you will need to have scripting support enabled on your webserver. Below are some examples using VB.NET scripting.

To understand more about our iSMS API Key features, please visit our Developer API page.


All available features and configurations will be displayed at the iSMS Developer API page. Integrate our SMS API into your VB.NET application and enjoy our SMS services.



Download VB.NET Demo Files

Please click below to find out about other programming language samples.




1. Firstly, register a username and password from iSMS Register Page.


It only requires a few information from you such as username, password and your mobile number. It is free.


After you have register an account, you will need to purchase some credit from iSMS Reload Page, you will receive an email containing the reload PIN if you purchase for the first time.


However, if you purchase more than once, the account is automatically credited. Login to iSMS website and insert the PIN.



2. Now you are ready.


Create a file called api_post.php in your host and paste the code below.

Private Function SendSMS(ByVal Test As Boolean, _
ByVal From As String, _
ByVal Type As String, _
ByVal Message As String, _
ByVal SendTo As String, _
ByVal URL As String) As String

    Const TransportURL As String ="http://www.isms.com.my/isms_send.php"
    Const TransportUserNameAs String ="myusername"
    Const TransportPasswordAs String ="mypassword"
    Const TransportVerboseAs Boolean =True
    Dim strPost As String

    strPost = "un=" + TransportUserName _
    + "&pwd=" + TransportPassword _
    + "&msg=" + System.Web.HttpUtility.UrlEncode(Message) _
    + "&sendid=" + From _
    + "&type=" + Type _
    + "&dstno=" + SendTo


 
    Dim request As WebRequest = WebRequest.Create(TransportURL)
    request.Method = "GET"
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPost)
    request.ContentType = "application/x-www-form-urlencoded"
    request.ContentLength = byteArray.Length
    Dim dataStream As Stream = request.GetRequestStream()
    dataStream.Write(byteArray, 0, byteArray.Length)
    dataStream.Close()

    Dim response As WebResponse = request.GetResponse()
    dataStream = response.GetResponseStream()
    Dim reader As New StreamReader(dataStream)
    Dim responseFromServerAs String = reader.ReadToEnd()
 
    reader.Close()
    dataStream.Close()
    response.Close()

    If responseFromServer.Length > 0 Then
        Return responseFromServer
    Else
        Return CType(response, HttpWebResponse).StatusDescription
    End If
End Function


Please click below to download demo files:


Download VB.NET Demo Files

Contact Us

Please contact us HERE, if you have any enquiries or looking for any consultation.

Email: sales@mobiweb.com.my

Note to registered users: Please include your Username in the email.

Phone Numbers:

  • 1800 87 7061 (Malaysia Toll Free)
  • +604 642 0621 (Penang, Malaysia)
  • +603 2780 3880 (Line 1 Kuala Lumpur, Malaysia)
  • +603 7980 1388 (Line 2 Kuala Lumpur, Malaysia)

Fax:

  • +604 611 5620 (Penang, Malaysia)
  • +603 7980 2388 (Kuala Lumpur, Malaysia)

Articles

 

SMS Coverage for All Countries Worldwide

A B C D E F G H I J K L M N O P Q R S T U V Y Z
divider