我在Nexmo创建了帐户,并从here尝试了此示例
<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => 'API_KEY',
'api_secret' => 'API_SECRET',
'to' => 'HERE REAL NUMBER',
'from' => 'HERE REAL NUMBER',
'text' => 'Hello from Nexmo'
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;但是,当我尝试时,此代码不会回显任何内容
curl "https://rest.nexmo.com/sms/json?api_key=KEY&api_secret=SECRET&from=NEXMO&to=911234567890&text=Welcome+to+Nexmo"我得到的响应是
{
"message-count": "1",
"messages": [{
"to": "911234567890",
"message-id": "070000000279DB5A",
"status": "0",
"remaining-balance": "1.96000000",
"message-price": "0.02000000",
"network": "41001"
}]
}如何让php代码正常工作?
发布于 2017-05-05 18:09:33
我知道这个问题很老,但我还是想回答它。您必须将API_KEY和API_SECRET的值替换为为您的帐户提供的值。
https://stackoverflow.com/questions/38345051
复制相似问题