malaiselvan Posted December 22, 2010 Share Posted December 22, 2010 Hi, I am writing a PHP program to send SMS using HTTP API gateway. I use cURL to launch the URL. I am getting problems when I send UNICODE chars in the message. I am getting simply square boxes instead of UNICODE chars. When I launch the same URL directly in a browser it works well. Following is the code snippet currently I have. $message = "unicode chars here"; $launch_api = "http://xxxsss.com/send.php?message=".$message."&sender=aaa&to=xxxx&type=2&username=bbbb&password=cccc"; $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL,$launch_api); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec ($ch); curl_close ($ch); Could some one please help me what I am missing? Quote Link to comment Share on other sites More sharing options...
malaiselvan Posted December 23, 2010 Author Share Posted December 23, 2010 I think I need to set the charset to utf-8. Could some one please help? Quote Link to comment Share on other sites More sharing options...
johnny86 Posted December 23, 2010 Share Posted December 23, 2010 $headers = array( "Content-Type: application/x-www-form-urlencoded; charset: UTF-8" ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.