Skip to main content

Command Palette

Search for a command to run...

SMS using PHP Clickatell REST API

Sending Greek, Romanian, Serbian or other extended charset message

Published
1 min read
SMS using PHP Clickatell REST API

I've had many issues regarding this. Even contacted their support. First we had to move away from HTML GET request which was very simple and fast, but uses only ASCII characters. Since company client communicates in many countries with different charcodes we had to find a way to send SMS.

Amazon SNS says: "Each SMS message can contain up to 140 bytes, and the character quota depends on the encoding scheme. For example, one SMS message can contain: 160 GSM characters or 140 ASCII characters or 70 UCS-2 characters"

Clickatell.com

First check SMS-API Documentation and setup simple REST call.

Archive of documentation I had to browse some documentation and found the answer at Advanced message send / Multi-language Unicode messaging

So for characters other than regular GSM characterset Clickatell expects UCS-2 (Big Endian) character encoding and unicode=1 parameter set. So 70 characters will be the limit. We will have to split the messages since our messages consist of up to 180 characters.

PHP code to convert UTF-8 text to HEX encoded UCS-2 acceptable by Clickatell:

$message = bin2hex(mb_convert_encoding($text, "UCS-2", "UTF-8"));