Send Hindi SMS Using API
Posted in: PHP

Send SMS in Hindi Using API

Send Hindi SMS using API is not that easy as it look like. While working on a project i have to send Hindi SMS and when i write hindi in message and send it to the mobile. It shows me ?????????????? ???????? ????? like this. So i figured out if we use unicode to send the message than we can send the SMS in Hindi or other language. This tutorial is about to send SMS in Hindi.



In this tutorial we are using the Bulk SMS API form Simply IT Solutions Pvt Ltd. They are providing fast and perfect delivery.

So here is the magical function to change your message to the UNICODE message.

Above line will change the message to the Unicode By using the below function.

After change the SMS to Unicode it will look like a list of many numbers. Now next part is to send the sms. As i told you earlier that we are using an API so we create a function and passing mobile no and message to that function.



It will send the SMS in Hindi. Hope you like it if you have any advice or comment than please write in the comment box.

 

Comments (13) on "Send SMS in Hindi Using API"

  1. Sir mein company ka referer link bahut saare customers ko bhejna chahta hu lekin 100 sms bhejne ke baad msg aata hai ki ab aapke paise ktenge. Aisa free sms wala koi system nhi hai jisse mein customers ko sms bhej sku. Api samajh nhi aa rha kya hai ye

  2. I have developed an application using VB 6.0 in which I usually send the sms using the code but when Try to send sms in hindi it displays like ????? ????? . Sir can I use the above convert function in my CV script?

  3. after using Unicode function in sms script I’m getting Chinese language in sms. ( after full stop in in one sentence . its taking another line in Chinese language.

    Please reply !!!

    1. Have you checked that your sms gateway supports the unicode. As many gateway provider put some type on the URL so that the gateway understand the actual characters encoding

  4. Thanks .. this article is very useful .. I am a C# developer and implemented your logic in my code .. it worked 🙂 .. Here is the code.. hope this may help others ..

    public string Utf8ToUnicode(string str)
    {
    var unicode = new List();
    var values = new List();
    var lookingFor = 1;
    var ascii = Encoding.UTF8.GetBytes(str);

    for (var i = 0; i < ascii.Length; i++)
    {
    var thisValue = ascii[i];
    if(thisValue == 32)
    {
    unicode.Add("%20");
    }
    else
    if (thisValue < 128)
    {
    var uniStr = ConvertToHex(thisValue);
    unicode.Add((uniStr.Length == 1) ? "%u000" + uniStr : "%u00" + uniStr);
    }
    else
    {
    if (values.Count == 0)
    lookingFor = (thisValue < 224) ? 2 : 3;
    values.Add(thisValue);
    if (values.Count == lookingFor)
    {
    var number = (lookingFor == 3) ?
    ((values[0] % 16) * 4096) + ((values[1] % 64) * 64) + (values[2] % 64) :
    ((values[0] % 32) * 64) + (values[1] % 64
    );
    var uniStr = number.ToString("X");
    unicode.Add((uniStr.Length == 3) ? "%u0" + uniStr : "%u" + uniStr);
    values = new List();
    lookingFor = 1;
    } // if
    } // if
    }
    return string.Join(“”, unicode.ToArray());
    }

  5. Sir am creating a mock test portal for SSC and given the questions in English only but there are so many students who prefer Hindi instead of english and I don’t want to re-type the all questions and options in Hindi, is there any way to display all English typed along with Hindi translation without handling it twice?

Leave a Reply

Your email address will not be published. Required fields are marked *