我正在尝试设置从我们的 pbx 发送短信,但我在 $data 行上不断收到语法错误。如果按原样尝试并使用 echo 但文本永远不会被发送。有谁知道我要去哪里错了?谢谢!!!
// 从 PBX 获取通话数据 $call_ani = $_POST['call_ani'];
$url = 'http://api.messaging.test.sms.net
$data="botkey=123456&apimethod=send&msg=HelloWorld&user='call_ani'&network=SMS&from=1111111111";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERPWD, 'User:Password');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
$xml = curl_exec($ch);
if (curl_error($ch)) {
print "ERROR ". curl_error($ch) ."\n<br/>";
}
curl_close($ch);
print_r($xml);