I try to send SMS by PHP, SMPP protocol and must use Net_SMPP library. My code:
$smsc = new Net_SMPP_Client('xxx.xxx.xxx.xxx', xxxx);
// Make the TCP connection first
$smsc->connect();
// Now bind to the SMSC. bind() and unbind() return the response PDU.
$resp = $smsc->bind(array(
'system_id' => '*****',
'password' => '*******',
'system_type' => ''
));
$message = "Привет!";
$message=iconv("utf-8", "UCS-2", $message);
$message=bin2hex ($message);
$ssm = Net_SMPP::PDU('submit_sm', array(
'source_addr_ton' => NET_SMPP_TON_ALNUM,
'dest_addr_ton' => NET_SMPP_TON_INTL,
'source_addr' => 'AnyName',
'destination_addr' => '7**********',
'short_message' => $message,
'dest_addr_npi' => 0x01,
'data_coding' => NET_SMPP_ENCODING_ISO10646 //UCS2 coding
));
$smsc->sendPDU($ssm);
But by phone comes message with braking-encoding (so-called foursquares).
So, changing data_coding by default
'data_coding' => NET_SMPP_ENCODING_DEFAULT
gives message "1f04400438043204350442042100" (hex-code of my message).
What did I go wrong?