News
IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. ***
  Jun 13 2015 8:52AM     Micheal
  5 Comments    6360 Views  
Here Micheal provided step by step procedure to Send SMS via Site2SMS with Mashape API Key.
About MashapeKey:
We can send SMS via Site2SMS with the help of Mashape API, For that we need Mashape API Key.
Click this link How to Generate Mashape API Key to Generate Mashape API Key.

If you are having Mashape API Key, Please follow the below steps to Send SMS via Site2SMS
STEP: 1
Open Visual Studio and Create New application.
STEP: 2
Create a page SendSMS.aspx to send SMS.
STEP: 3
HTML Code:
Copy the HTML code and paste it in your design page.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">    
    <title>SMS - The Developer Tips</title>    
</head>
<body>
    <form id="form1" runat="server">
    <div style="padding: 40px">
        
        <div><span style="font-size: 25px; color: #81B441">The Developer Tips</span>
        <span style="font-size: 12px;"> - Beyond the Knowledge</span>
        </div>        
        <hr >
        <br >
        <br >
        <div><span style="font-size: 30px;">My SMS App</span></div>
        <br >
        <br >
        <table>
            <tr>
                <td>
                    <label>
                        Mobile Number:</label>
                </td>
                <td>
                    <asp:TextBox ID="txtReceiverMobileNumber" Width="200px" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr style="margin-top: 25px;">
                <td>
                    <label>
                        Message:</label>
                </td>
                <td>
                    <asp:TextBox ID="txtMessage" TextMode="MultiLine" Width="200px" Height="80px" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr style="margin-top: 25px;">
                <td>
                    <label>
                    </label>
                </td>
                <td>
                    <asp:Label ID="lblMsg" Visible="false" runat="server"></asp:Label>
                </td>
            </tr>
            <tr style="margin-top: 25px;">
                <td>
                    <label>
                    </label>
                </td>
                <td align="right">
                    <br >
                    <asp:Button ID="btnSend" runat="server" CssClass="btn" Text="Send SMS" OnClick="btnSend_Click" />
                </td>
            </tr>
        </table>
        <br >
    </div>
    </form>
</body>
</html>
STEP: 4
C# Code:
Copy this C# code and paste it in your code page. [For Send Button Click Method]
        protected void btnSend_Click(object sender, EventArgs e)
        {
            string senderMobileNo = "***SEND MOBILE NUMBER***";
            string senderPassword = "***SENDER SITE2SMS PASSWORD***";
            string MshapeKey = "***GENERATED MASHAPE API KEY***";
            bool isSent = true;
            try
            {
                if (!string.IsNullOrEmpty(txtReceiverMobileNumber.Text) && !string.IsNullOrEmpty(txtMessage.Text))
                {
                    // Calling SMS Class to use Send Method.
                    // Passing MobileNo, Password, MshapreKey, ReceiverMobileNo and Message as parameter of Send Method.
                    isSent = Send(senderMobileNo, senderPassword, MshapeKey, txtReceiverMobileNumber.Text.Trim(), txtMessage.Text.Trim());
                    lblMsg.Visible = true;
                    if (isSent)
                        lblMsg.Text = "Message Sent Successfully..";
                    else
                        lblMsg.Text = "Message sending Failed..";
                }
                else
                {
                    lblMsg.Visible = true;
                    lblMsg.Text = "MobileNo and Message is mandatory.";
                }
            }
            catch (Exception ex)
            {
                lblMsg.Visible = true;
                lblMsg.Text = ex.Message.ToString();
            }
        }
STEP: 5
C# Code:
Method for Send SMS [Send() Method Definition]
        public static bool Send(string senderMobileNo, string senderPassword, string MshapeKey, string receiverMobileNo, string Message)
        {
            bool isSent = true;          
            try
            {
                WebRequest request = WebRequest.Create("https://site2sms.p.mashape.com/index.php?msg="
                    + Message + "&phone=" + receiverMobileNo + "&pwd=" + senderPassword + "&uid=" + senderMobileNo);
                request.Headers.Add("X-Mashape-Key", MshapeKey);               
                WebResponse response = request.GetResponse();
                return isSent;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
Demo:
You can send SMS here.


I hope this page will helps to Send SMS via Site2SMS. Thanks.
BackToTop
Comments


AnonymousUser
Jan 12 2016 11:35PM
Not getting sms using demo
Vishwanath
Jan 13 2016 11:51PM
Make sure, Entered mobile number is not in DND ( Do not Disturb ) because site2sms does not send sms to DND registered numbers.
Nyra Simon
Feb 27 2016 7:20AM
Not getting sms using demo even if number is not DND
dine
Oct 5 2016 12:31AM
DEMO NOT WORKING
sivansakthi
Jan 9 2017 8:00AM
demo is not working

 
Search
Recent Posts
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Nov 8 2017 10:26AM Posted By Pranav
Google URL Shortener in C#
Oct 26 2017 10:43AM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Jun 18 2017 11:38PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Feb 27 2017 11:51AM Posted By John
Gridview custom CSS in ASP.Net
Feb 25 2017 10:59AM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Feb 25 2017 10:20AM Posted By Micheal
Read excel file and convert to List in C#
Feb 25 2017 6:26AM Posted By Michael
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: