Plain Http Api


Resource URL
http://sms.icore.net.in/vendorsms/pushsms.aspx?apiKey=abc&clientid=abc123&msisdn=919898xxxxxx&sid=WEBSMS&msg=Test%20Message&fl=0

Response

        {
            "ErrorCode":"000",
            "ErrorMessage":"Success",
            "JobId":"381a8090-b230-42fa-ac04-157cc2142bfa",
            "MessageData":[{
                    "Number":"919898xxxxxx ",
                    "MessageParts":[{
                            "MsgId": "919898xxxxxx -67e3765cdf034f438a432eacb88d0c14",
                            "PartId":1,
                            "Text":"Test Message"
                        }]
            }]
        }

Resource URL Parameters
Name Type Description
apiKey string User's ApiKey
clientid string User's ClientId
msisdn string Receiver's Mobile Number
sid string Six digit SenderId approved by the administrator
msg string Text Message to be send to the user.
fl string Indicates whether message type is flash message or not.
If it's flash message then fl=1 or else fl=0.
gwid string Indicates the type of message; either Promotional or Transactional.
Not Required for Promotional. For Transactional gwid=2.

XML Api


Resource URL
http://sms.icore.net.in/Rest/Messaging.svc/mtsms?data=

        <SmsQueue>
            <Account>
                <apikey>abc</apikey>
                <clientid>abc123</clientid>
            </Account>                                
            <MessageData>
                <SenderId>WEBSMS</SenderId>
                <Gwid>1</Gwid>
                <DataCoding>0</DataCoding>
            </MessageData>                                
            <Messages>
                <Message>
                    <Number>919898XXXXX</Number>
                    <Text>Message from xml</Text>
                </Message>
            </Messages>
        </SmsQueue>

Response

        <Response>
            <ErrorCode>000</ErrorCode>
            <ErrorMessage>Success</ErrorMessage>
            <JobId>5403ff81-f1aa-420a-9430-8d86f4061a79</JobId>                                
            <MessageData>
                <Messages>
                    <MessageParts>
                        <MessagePart>
                            <MessageId>9198981XXXXX -2c21cdcc976f4fd78a17b571f12fb4f7</MessageId>
                            <MessagePartId>1</MessagePartId>
                            <MessageText>Message from xml</MessageText>
                        </MessagePart>
                    </MessageParts>
                    <MobileNumber>919898XXXXX</MobileNumber>
                </Messages>
            </MessageData>
        </Response>

Resource URL Parameters
Name Type Description
apikey string User's ApiKey
clientid string User's ClientId
Number string Receiver's Mobile Number
SenderId string Six digit SenderId approved by the administrator
Text string Text Message to be send to the user.
Data Coding string This Datacoding parameter is used to send unicode message.
Set this to 8 for message language other than english.
Gwid string Indicates the type of message; either Promotional or Transactional.
For Promotional Gwid=1. For Transactional Gwid=2.

Sample Code



VB


Code Snippet

        Imports System
        Imports System.Net
        Imports System.IO
        Module Program
        Sub Main(args As String())

        Dim sURL As String
        sURL="http://sms.icore.net.in/vendorsms/pushsms.aspx?apikey=abc&
                clientid=abc123&msisdn=919898xxxxxx&sid=WEBSMS&msg=Test%20Message&fl=0"

        Dim wrGETURL As WebRequest
        wrGETURL = WebRequest.Create(sURL)

        Dim objStream As Stream
        objStream = wrGETURL.GetResponse.GetResponseStream()

        Dim objReader As New StreamReader(objStream)
        Dim sLine As String = ""
        Dim i As Integer = 0

        Do While Not sLine Is Nothing
        i += 1
        sLine = objReader.ReadLine
        If Not sLine Is Nothing Then
        Console.WriteLine("{0}:{1}", i, sLine)
        End If
        Loop

        Console.ReadLine()

        End Sub
        End Module

Java


Code Snippet

        import org.apache.commons.httpclient.*;
        import org.apache.commons.httpclient.methods.*;
        import org.apache.commons.httpclient.params.HttpMethodParams;
        import java.io.IOException;
        import java.io.UnsupportedEncodingException;

        public class HttpUrlPush {
            public static void main(String[] args)throws IOException {
                HttpClient client=null;
                PostMethod post=null;
                String sURL;
                client = new HttpClient(new MultiThreadedHttpConnectionManager());
				/* Set your proxy settings */
				client.getHostConfiguration().setProxy("Your Proxy", ProxyPort);
                client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);
                //set your time
                sURL = "http://sms.icore.net.in/vendorsms/pushsms.aspx";
                post = new PostMethod(sURL);
                //give all in string
                post.addParameter("apikey", "abc");
                post.addParameter("clientid", "abc123");
                post.addParameter("msisdn", "919898XXXXXX");
                post.addParameter("sid","WEBSMS");
                post.addParameter("msg", "Test Message");
                post.addParameter("fl", "0");

                /* PUSH the URL */
                try {
                        int statusCode = client.executeMethod(post);
                        System.out.println(post.getStatusLine().toString());
                        if (statusCode != HttpStatus.SC_OK) {
                        System.err.println("Method failed: " + post.getStatusLine());
                    }
                    System.out.println(post.getResponseBodyAsString());
                }
                catch (Exception e) {
                    e.printStackTrace();
                }
                finally {
                    post.releaseConnection();
                }
            }
        }
        /* Developed by using COMMONS-HTTPCLIENT Api of apache
        Note- set the classpath to all the jar files of commons-httpclient api and its
        Dependencies */

C#


Code Snippet

        using System
        using System.IO
        using System.Net
        using System.Text
        using System.Web

        string sApiKey= "abc";
        string sClientId= "abc123";
        string sNumber = "919898XXXXXX";
        string sSID = "WEBSMS";
        string sMessage = "Test Message";

        string sURL = "http://sms.icore.net.in/vendorsms/pushsms.aspx?&apikey=" + sApiKey+ "
        &clientid=" + sClientId+ "&msisdn=" + sNumber + "&sid=" + sSID + "&msg=" + sMessage + "&fl=0";

        string sResponse = GetResponse(sURL);
        Response.Write(sResponse);

        public static string GetResponse(string sURL)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);
            request.MaximumAutomaticRedirections = 4;
            request.Credentials = CredentialCache.DefaultCredentials;
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
                Stream receiveStream = response.GetResponseStream ();
                StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);
                string sResponse = readStream.ReadToEnd();
                response.Close ();
                readStream.Close ();
                return sResponse;
            }
            Catch
            {
                return "";
            }
        }

Python


Code Snippet

        import requests

        def PushSMS(apikey,clientid,msisdn,sid,msg,fl):
            try:
                param= {
                    "apikey":apikey,
                    "clientid":clientid,
                    "msisdn":msisdn,
                    "sid":sid,
                    "msg":msg,
                    "fl":fl
                }
                url="http://sms.icore.net.in/vendorsms/pushsms.aspx";
                response = requests.get(url,param)
                data = response.json()
                print("got response %s"%response,data)

            except requests.exceptions.RequestException as e:
                print("Exception Occur:%s"%e)
                raise (e.args)

        if __name__ == '__main__':
            PushSMS("abc","abc123","919898XXXXXX","WEBSMS","Test Message","0")

PHP


Code Snippet

        <?php
            function PostRequest($url, $_data) {
            // convert variables array to string:
                $data = array(); 
                while(list($n,$v) = each($_data))
                {
                    $data[] = "$n=$v";
                }
                $data = implode('&', $data);
                // format --> test1=a&test2=b etc.
                // parse the given URL
                $url = parse_url($url);
                if ($url['scheme'] != 'http') {
                    die('Only HTTP request are supported !');
                }
                // extract host and path:
                $host = $url['host'];
                $path = $url['path'];
                // open a socket connection on port 80
                $fp = fsockopen($host, 80);
                // send the request headers:
                fputs($fp, "POST $path HTTP/1.1\r\n");
                fputs($fp, "Host: $host\r\n");
                fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
                fputs($fp, "Content-length: ". strlen($data) ."\r\n");
                fputs($fp, "Connection: close\r\n\r\n");
                fputs($fp, $data);
                $result = '';
                while(!feof($fp)) {
                    // receive the results of the request
                    $result .= fgets($fp, 128);
                }
                // close the socket connection:
                fclose($fp);
                // split the result header from the content
                $result = explode("\r\n\r\n", $result, 2);
                $header = isset($result[0]) ? $result[0] : '';
                $content = isset($result[1]) ? $result[1] : '';
                // return as array:
                return array($header, $content);
            }
            $data = array(
                'apikey' => "abc",
                'clientid' => "abc123",
                'msisdn' => "919898XXXXXX",
                'sid' => "WebSMS",
                'msg' => "Test Message",
                'fl' =>"0",
            );
            list($header, $content) = PostRequest("http://sms.icore.net.in/vendorsms/pushsms.aspx",
                $data
            );
            echo $content;
        ?>