Hi all,
For those of you interested in using the Awaresoft Clickatell plugin and if you use utf-8 extended characters (like I do for Swedish, Danish etc. characters). The Clickatell gateway cannot handle these characters and you have to manually convert the SMS to unicode hex before sending it to the gateway. I have a working PHP script I can share if you need it. Send me a PM and I´ll send you the script.
PS: Support, would it be possible to use the PHP script I´ve got to make a function for this instead? I will send you the script and this question.
Here is the script source link if you want to read/look at it:
http://stackoverflow.com/questions/1383 ... ng-garbled
Resource: Clickatell unicode convert script
Resource: Clickatell unicode convert script
Henrik (V8 Developer Ed. - Windows)
Re: Resource: Clickatell unicode convert script
Here is the code from the PHP script (didn´t think about sharing it in the previous post). The script converts a string (UTF-8 to uincode hex) and then writes the output to a txt file. this can porbably also be used to convert other formats etc. NB The actual php script file HAS to be saved in the encoding you want to convert FROM (i.e UTF-8 in this example):
Code: Select all
<?php
$text = "Message";
$arr = unpack('H*hex', iconv('UTF-8', 'UCS-2BE', $text));
$add = strtoupper($arr['hex']);
$f = fopen("output.txt", "w");
fwrite($f, $add);
fclose($f);
?>
Henrik (V8 Developer Ed. - Windows)
-
- Posts: 2431
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Resource: Clickatell unicode convert script
Henrik,
I guess I will look pretty dumb asking this question
so I will go ahead and ask it to remove all doubt.
How do I execute php code like that on my Aware IM
server?
Baby steps please.
I guess I will look pretty dumb asking this question
so I will go ahead and ask it to remove all doubt.
How do I execute php code like that on my Aware IM
server?
Baby steps please.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Resource: Clickatell unicode convert script
Mark,
I am a PHP newbie myself so my way of doing this (see below) might not be ideal and actually other developers, anyone good at PHP and good at PHP/Aware IM integration that have tips for doing this another, better way, please chip in.
Here is what I do:
I use a batch file to execute the script (script.bat):
I use Aware IM tags in the PHP script:
I use a Aware IM txt document template that I export as part of SMS convert process:
I use Aware IM EXECUTE PROGRAM to execute the bat file / script:
I use Aware IM URL_CONTENTS to read the output.txt file back to Aware IM:
I am working on a queue solution where SMS if created simultaneously, the SMS will get a execution no and will be executed in order (part of this solution might also be actions to delete previous php and output etc. files).
I am a PHP newbie myself so my way of doing this (see below) might not be ideal and actually other developers, anyone good at PHP and good at PHP/Aware IM integration that have tips for doing this another, better way, please chip in.
Here is what I do:
I use a batch file to execute the script (script.bat):
Code: Select all
"C:\Program Files (x86)\PHP\v5.5\php.exe" -f "C:\Scripts\phpunicode.php"
Code: Select all
<?php
$text = "<<Sms.Message>>";
$arr = unpack('H*hex', iconv('UTF-8', 'UCS-2BE', $text));
$add = strtoupper($arr['hex']);
$f = fopen("C:\Scripts\output.txt", "w");
fwrite($f, $add);
fclose($f);
?>
Code: Select all
EXPORT DOCUMENT PhpUnicode TO FILE 'C:\Scripts\phpunicode.php'
Code: Select all
EXECUTE PROGRAM 'C:\Scripts\script.bat'
Code: Select all
Sms.Unicode=URL_CONTENTS('file:\\\C:\Scripts\output.txt')
Henrik (V8 Developer Ed. - Windows)