没有提供使用PHP的阿拉伯文Gammu SMS [英] Gammu SMS in Arabic using PHP does not be delivered

查看:124
本文介绍了没有提供使用PHP的阿拉伯文Gammu SMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PHP在服务器上拥有自己的SMS网关.我已经安装了Gammu,并且很好地配置了权限和设置.现在,它使用以下原型脚本发送SMS罚款:

I'm trying to have my own SMS gateway on my server using PHP. I have installed Gammu and I configured the permissions and settings well. Now it send SMS fine using the following prototype script:

<?php
$text = $_POST['text'];
$numb = $_POST['numb'];
if ($text != '' && $numb != ''){
  //die('echo "'.$text.'" | gammu --sendsms TEXT '.$numb);
  echo "<pre>";
  //die(passthru('whoami'));
  $command = 'echo "'.$text.'" | gammu --sendsms TEXT '.$numb.' >> '.__DIR__.'/smslog.txt';//.'" | gammu --sendsms TEXT '.$numb;

  echo passthru($command);
  //echo $command;
}
else{
  ?>
  <form method="POST">
  <input type="text" name="numb">
  <textarea name="text"></textarea>
  <input type="submit">
  </form>
  <?php
}
?>

但是,英语文本(拉丁)短信一切正常,但是尽管运营商回复了OK,但尝试发送阿拉伯语SMS却未能传递到目的地,

However, everything works fine with English text (Latin) SMS, but trying to send Arabic SMS failed to be delivered to the destination in spite of carrier respond with OK,

Sending SMS 1/1....waiting for network answer..OK, message reference=18

我还注意到,在终端上,使用相同的带有阿拉伯文本的gammu命令,效果很好,但是具有?? ??????? ???文本表示形式.我部分地相信这是编码问题,但是我不知道如何解决.

Also, I noticed that, from terminal, using the same gammu command with Arabic text, it delivered well, but with ?? ??????? ??? text representation. I am, partially, believe that it is encoding issue, but I have no idea how to solve it.

我的服务器是Ubuntu Linux 16.04.

My server is Ubuntu Linux 16.04.

我想出了如何使用gammu命令从bash发送阿拉伯文本,如下所示,其中使用了-unicode选项:

I have figured out how to send Arabic text from the bash using gammu command like the following in which -unicode option is used:

gammu sendsms TEXT 022222222 -unicode -text "نص عربي"

但是,上面提到的脚本,发送阿拉伯语消息,但在电话上看起来像333333333.我什么都不知道 通过以下方式发送到命令流时,字符串发生了错误 passthru,我也尝试使用exec并获得相同的结果.

However, the script regarded above, send the Arabic message but it look something like 333333333 on the phone. I have no any idea about what occurred to the string when it send to the command stream via passthru and I tried to use exec also and the same result.

推荐答案

最后,在多次阅读本节内容以及许多尝试,我发现正确的命令选项如下所示:

Finally after many reading of this section of documentation and many tries, I have found the correct command's options to be like the following:

gammu -c /etc/gammurc sendsms  TEXT 02222000 -unicode -textutf8 "نص عربي"

在上面的示例中,使用-textutf8代替了-text.另外,请注意,可选地提供了-c配置文件路径,以确保要使用哪种设备.

In the above example -textutf8 is used instead of -text. Also, notice that -c configurations file path is supplied optionally to just make sure what device is going to be used.

这篇关于没有提供使用PHP的阿拉伯文Gammu SMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆