Skip to content

Recent Articles

20
Oct

Sample Code for Send sms via Bulk SMS API Using PHP

Signup from a bulk sms provider.and modify the code according to that http api link.

<?php
$domain     =     "mydomain.co.in";
$uname      =     "myusername";
$pwd          =     "mypassword";
$to             =     "9999000000";//reciever 10 digit number (use
comma (,) for multiple users. eg: 9999999999,8888888888,7777777777)
$sms         =     "test sms";//sms content
$sender     =     "TESTDEMO";// sender id. this may be a number
$route       =     "A";// sending route
$sms = urlencode($sms);
$sender = urlencode($sender);
// set parameters the API for sending sms
$parameters="uname=$uname&pwd=$pwd&senderid=$sender&to=$to&msg=$sms&route=$route";
// call the Api
$fp = fopen("http://$domain/sendsms?$parameters", "r");
$response = stream_get_contents($fp); // get response of API call
echo "Success : ".$response; exit; // if response is a number...........
// this was the message id returned. save it for delivery report..........
// you can use your own logic and functions for
// your requirement...
?>
19
Oct

Version 2 ,Sample Code for Send sms via Bulk SMS API Using C#

Modified version of old post “Sample Code for Send sms via Bulk SMS API Using C#

Signup from a bulk sms provider.and modify the code according to that http api link.

 

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class Default2 : System.Web.UI.Page
{
   // public string api = "mydomain.co.in/sendsms/myusername/mypassword/SenderID/number(s)/message/route";

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnClear_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtPassword.Text = "";
        txtDomain.Text = "";
        txtSenderId.Text = "";
        txtMobile.Text = "";
        txtMessage.Text = "";
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
          string  mobile = txtMobile.Text;
          string message = txtMessage.Text;
          string username = txtName.Text;
          string password = txtPassword.Text;
          string _sender = txtSenderId.Text;
          string domian = txtDomain.Text;
          string route = txtrout.Text;

          string api = "http://" + domian + "/sendsms/" + username + "/" + password + "/" + _sender + "/" + mobile + "/" + message + "/" + route + "";
          Response.Write(apiFunction(api));
        }
        catch
        {
        }
    }
    protected String apiFunction(string strapi)
    {
        try
        {
            string url = strapi;
            HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
            string getDetails = "Argument=SomeTestArguments";
            ASCIIEncoding sendEncoding = new ASCIIEncoding();
            byte[] byte1 = sendEncoding.GetBytes(getDetails);
            myHttpWebRequest.Method = "POST";
            myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
            myHttpWebRequest.ContentLength = getDetails.Length;
            Stream sendStream = myHttpWebRequest.GetRequestStream();
            sendStream.Write(byte1, 0, byte1.Length);
            sendStream.Close();
            WebResponse myWebResponse = myHttpWebRequest.GetResponse();
            Stream ReceiveStream = myWebResponse.GetResponseStream();
            Encoding readEncoding = System.Text.Encoding.GetEncoding("utf-8");
            StreamReader readStream = new StreamReader(ReceiveStream, readEncoding);
            Char[] read = new Char[256];
            int count = readStream.Read(read, 0, 256);
            String str = "";
            if (count &gt; 0)
            {
                str = new String(read, 0, count);
            }
            readStream.Close();
            myWebResponse.Close();
            return str;// this is the response
        }
        catch (Exception exp)
        {
            string error_msg = exp.Message;
            return "failed";
        }
    }

}

Untitled-1

Demo         Download

16
Oct

Sample Code for Send sms via Bulk SMS API Using C#

Signup from a bulk sms provider.and modify the code according to that http api link.
HTTP API for sending message to single no

http://domainname.com/sendsms?uname=yourUsername&pwd=yourPassword&senderid=yourSenderid&to=9444xxxxxx&msg=yourMessage&route=yourRoute

We Provide several api’s such as

  • HTTP API for sending message to multiple nos,
  • HTTP API for sending Scheduled message,
  • HTTP API for Checking credits left for given route,
  • HTTP API for Checking credits for all routes,
  • HTTP API for Checking Delivery report of sent SMS through HTTP API

Sample Code for Send sms via Bulk SMS API Using C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public string mobile
    {
        get;
        set;
    }
    public string message
    {
        get;
        set;
    }
    public string username
    {
        get;
        set;
    }
    public string password
    {
        get;
        set;
    }
    public string domian
    {
        get;
        set;
    }
    public string sender
    {
        get;
        set;
    }
    public string route
    {
        get;
        set;
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            mobile = txtMobile.Text;
            message = txtMessage.Text;
            username = txtName.Text;
            password = txtPassword.Text;
            sender = txtSenderId.Text;
            domian = txtDomain.Text;
            route = txtrout.Text;
            string result = apicall("http://" + domian + "/sendsms?uname=" + username + "&pwd=" + password + "&senderid=" + sender + "&to=" + mobile + "&msg=" + message+ "&route=" + route);

            if (!result.StartsWith("Wrong Username or Password"))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sent')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sending Failed')", true);
            }

        }
        catch
        {
        }
    }
    public string apicall(string url)
    {
        HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);

        try
        {

            HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();

            StreamReader sr = new StreamReader(httpres.GetResponseStream());

            string results = sr.ReadToEnd();

            sr.Close();
            return results;

        }
        catch
        {
            return "0";
        }
    }
    protected void btnClear_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtPassword.Text = "";
        txtDomain.Text = "";
        txtSenderId.Text = "";
        txtMobile.Text = "";
        txtMessage.Text = "";
    }
}

 

sms
Demo                    Download

16
Oct

This Website is Under Construction Sample HTML code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Under Construction</title>
</head>
<body>
<br><br><br><br><br><br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<h1 style="margin:0;padding:0;font-family: trebuchet ms;">This Website is Under Construction.
<br><small style="color: #888;" align="center">Come Back Soon.</small>
</h1>
</td>
</tr>
</table>
</body>
</html>

Step 1: Just copy past the code to notepad,select save as from file menu,type file name as index.html ,select save as type as All Files.Then click save.

notepad
index

 

 

 

 

 

Step 2: After that upload the index.html file to root folder of hosting space.Hosting provider will provide the login details of hosting panel.
cpanel

 

 

 

Demo            Download

 

13
Oct

Windows Environment Variables Settings For Java

Environment Variables Settings
User Variable

CLASS_PATH
 .;C:\Program Files\Java\jdk1.7.0_40\lib\tools.jar

System Variables

Path
 C:\Program Files\Java\jdk1.7.0_40\bin;