【发布时间】:2012-07-28 22:59:41
【问题描述】:
我尝试通过 RoutoMessaging PHP API 发送短信。我阅读了我能找到的所有文档和示例。 他们有用于以 unicode 格式发送 SMS 的 PHP 示例脚本:
<?php
// include RoutoSMS class
include("RoutoTelecomSMS.php");
// creating object
$sms = new RoutoTelecomSMS;
// setting login parameters
$sms->SetUssms->SetOwnNum("44792838383838");
$sms->SetType("unicode");
// get values entered from FORM
$sms->SetNumber($number);
$message="04220432043E04580435002004370435043B0435043D04350020043E0
44704380020044104430020043C04380020043F0430043C043504420020043F043E
043C044304420438043B0435002E002E002E";
$sms->SetMessage($message);
// send SMS and print result
$smsresult = $sms->Send();
print $smsresult;
?>
我不明白的是如何将文本从提交的字符串转换为包含在 $message 中所需的代码。 任何人都可以建议将文本转换为 $message 的功能吗? 我目前使用 PHP 5.3.3 版。
【问题讨论】:
-
如果你的号码实际上是(那个数字减去额外的 38 个),那么我建议删除它。
-
AFAIK SMS 使用一种非常古老的编码,称为 PDU。如果您的库没有在内部将 Unicode 转换为 PDU,则您必须自己进行。
标签: php string function unicode