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
<html>
<title>Unicode testing</title>
<form action="send.php" method="POST" name="adminForm" id="adminForm" enctype="multipart/form-data">
<textarea name="message" rows="10" cols="30"></textarea>
<input type="submit" value="Send">
</form>
</html>
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
$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;
?>
I get error ERR: 116, Invalid Unicode data
Could someone please help me???