/bulk-sms-service/gateway-c/

Atomic SMS Sender

Bulk SMS Service

SMS gateway usage example for C#

Send sms
Getting status of sms sent
Getting a price of the sms
Getting current balance

 

Send sms:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var XML = "XML=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                            "<SMS>\n" +
                            "<operations>\n" +
                            "<operation>SEND</operation>\n" +
                            "</operations>\n" +
                            "<authentification>\n" +
                            "<username></username>\n" +
                            "<password></password>\n" +
                            "</authentification>\n" +
                            "<message>\n" +
                            "<sender>SMS</sender>\n" +
                            "<text>Test message [UTF-8]</text>\n" +
                            "</message>\n" +
                            "<numbers>\n" +
                            "<number messageID=\"msg11\">380972920000</number>\n" +
                            "</numbers>\n" +
                            "</SMS>\n";
                HttpWebRequest request = WebRequest.Create("http://api.atompark.com/members/sms/xml.php") as HttpWebRequest;
                request.Method = "Post";
                request.ContentType = "application/x-www-form-urlencoded";
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] data = encoding.GetBytes(XML);
                request.ContentLength = data.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(data, 0, data.Length);
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    Console.WriteLine(reader.ReadToEnd());
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }
        }
    }
}

Getting status of sms sent*:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var XML = "XML=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                            "<SMS>\n" +
                            "<operations>\n" +
                            "<operation>GETPRICE</operation>\n" +
                            "</operations>\n" +
                            "<authentification>\n" +
                            "<username></username>\n" +
                            "<password></password>\n" +
                            "</authentification>\n" +
                            "<statistics>\n" +
                            "<messageid>msg11</messageid>\n" +
                            "</statistics>\n" +
                            "</SMS>\n";
                HttpWebRequest request = WebRequest.Create("http://api.atompark.com/members/sms/xml.php") as HttpWebRequest;
                request.Method = "Post";
                request.ContentType = "application/x-www-form-urlencoded";
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] data = encoding.GetBytes(XML);
                request.ContentLength = data.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(data, 0, data.Length);
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    Console.WriteLine(reader.ReadToEnd());
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }
        }
    }
}

* The sms status information will be available in a few minutes

Getting a price of the sms:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var XML = "XML=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                            "<SMS>\n" +
                            "<operations>\n" +
                            "<operation>GETPRICE</operation>\n" +
                            "</operations>\n" +
                            "<authentification>\n" +
                            "<username></username>\n" +
                            "<password></password>\n" +
                            "</authentification>\n" +
                            "<message>\n" +
                            "<sender>SMS</sender>\n" +
                            "<text>Test message [UTF-8]</text>\n" +
                            "</message>\n" +
                            "<numbers>\n" +
                            "<number messageID=\"msg11\">380972920000</number>\n" +
                            "</numbers>\n" +
                            "</SMS>\n";
                HttpWebRequest request = WebRequest.Create("http://api.atompark.com/members/sms/xml.php") as HttpWebRequest;
                request.Method = "Post";
                request.ContentType = "application/x-www-form-urlencoded";
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] data = encoding.GetBytes(XML);
                request.ContentLength = data.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(data, 0, data.Length);
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    Console.WriteLine(reader.ReadToEnd());
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }
        }
    }
}

Getting current balance

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var XML = "XML=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                            "<SMS>\n" +
                            "<operations>\n" +
                            "<operation>BALANCE</operation>\n" +
                            "</operations>\n" +
                            "<authentification>\n" +
                            "<username></username>\n" +
                            "<password></password>\n" +
                            "</authentification>\n" +
                            "</SMS>\n";
                HttpWebRequest request = WebRequest.Create("http://api.atompark.com/members/sms/xml.php") as HttpWebRequest;
                request.Method = "Post";
                request.ContentType = "application/x-www-form-urlencoded";
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] data = encoding.GetBytes(XML);
                request.ContentLength = data.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(data, 0, data.Length);
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    Console.WriteLine(reader.ReadToEnd());
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }
        }
    }
}
Perfect service! I work with the module for WHMC. Thank you!!!!  Read more »
Roman
VoiceHost
i am grateful for this development and i recommend you so much. Keep it up Read more »
United Nation GH Ashanti
Start using Atomic SMS Sender today for free!

 

Activate your account and get 10 SMS messages to try our service for free.

Click the "download" button to download software and then click the "save file" button when prompted.