Hi,
I am developing a PHP program to send SMS which contains non ASCII (Tamil, French, etc…) language characters.
I use cURL to launch the SMS HTTP API. I am struggling for this for almost a month and it always driving me to nuts.
I have a form as below
[php]
Unicode testing [/php]It is a very simple form with 1 text area where I will type the message in tamil, french, english etc…) Once I hit the send button it will invoke the below php program
[php]<?php
$message = $_POST['message'];
$url = "http://api.clickatell.com/http/sendmsg?user=user&password=pppp&from=JEEMA&api_id=11111&unicode=1&to=9444871902";
$url .= "&text=".urldecode($message);
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,array ("Content-Type: text/xml; charset=utf-8"));
$contents = curl_exec ($ch);
curl_close ($ch);
$contents = ltrim(rtrim(trim(strip_tags(trim(preg_replace ( "/\s\s+/" , " " , html_entity_decode($contents)))),"\n\t\r\h\v\0 ")), "%20");
echo $contents;
?>[/php]
I get error ERR: 116, Invalid Unicode data
Could someone please help me???