PHP使用nexmo发送短信
我正在使用nexmo服务以希伯来语向特定号码发送短消息,但消息以%D7%AA%D7的形式到达。(我的语言是PHP),这是我的代码:PHP使用nexmo发送短信,php,nexmo,Php,Nexmo,我正在使用nexmo服务以希伯来语向特定号码发送短消息,但消息以%D7%AA%D7的形式到达。(我的语言是PHP),这是我的代码: $message = $_REQUEST["message"]; //Build the url $url = 'https://rest.nexmo.com/sms/json?' . http_build_query( [ 'api_key' => '******', 'api_secret' => '******
$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;
尝试在请求中添加
类型
参数
//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文档页面中查看更多信息。尝试在post参数中添加
'type'=>'unicode'
,我想在哪里插入这一行?与其他post参数一起,例如在text
参数之后。您能在代码中显示我吗?