【问题标题】:PHP send SMS with nexmoPHP用nexmo发送短信
【发布时间】:2017-10-27 02:15:15
【问题描述】:

我正在使用 nexmo 服务向特定号码 IN HEBREW 发送 SMS,但消息以 %D7%AA%D7 的形式到达。 (我的语言是 PHP),这是我的代码:

$message = $_REQUEST["message"];

//Build the url 
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
    [
      'api_key' =>  '******',
      'api_secret' => '*******',
      'to' => '9725433131',
      'from' => '4416329600',
      'text' => urlencode($message)
    ]
);
//Send the data
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
$response = curl_exec($ch);

echo $response;

【问题讨论】:

  • 尝试在帖子参数中添加'type' => 'unicode'
  • 我想在哪里插入这一行?
  • 与其他帖子参数一起,例如在 text 参数之后。
  • 你能在代码中给我看一下吗?

标签: php nexmo


【解决方案1】:

尝试在请求中添加type参数。

//Build the url 
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
      'api_key' =>  '******',
      'api_secret' => '*******',
      'to' => '9725433131',
      'from' => '4416329600',
      'text' => urlencode($message),
      'type' => 'unicode'
    ]
);

您可以在 nexmo 文档页面中find 了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多