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? Link to comment https://forums.phpfreaks.com/topic/222403-passing-unicode-chars-using-curl/ 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? Link to comment https://forums.phpfreaks.com/topic/222403-passing-unicode-chars-using-curl/#findComment-1150644 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); Link to comment https://forums.phpfreaks.com/topic/222403-passing-unicode-chars-using-curl/#findComment-1150756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.