我正在尝试向多个收件人发送短信。我试图实现这一点的代码是这样的:我面临的问题是消息仅传递到表中的第一条记录。
需要一些帮助,我哪里出错了?
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$result = mysql_query("SELECT name,mobile FROM members");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
while($row = mysql_fetch_row($result)) {
$mobile=$row[1];
$name=$row[0];
$request = "";
$param['mobileno'] = "91". $mobile;
$param['message'] = "Dear $name (organisation name) wishes you a very very Happy Birthday";
$param['username'] = "username";
$param['password'] = "password";
$param['sendername'] = "sender";
foreach ($param as $key => $val ){$request .= $key . "=" . urlencode($val);
$request .= "&";}$request = substr( $request, 0, strlen( $request ) - 1 );
$url = "http://smsapi" . $request;
$ch = curl_init($url);curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec($ch);
var_dump($result);exit;
curl_close( $ch );
}