ถามเเรื่อง sms การวนลูปส่งเบอร์โทรค่ะ

คือต้องการให้มันส่งได้หลายๆๆเบอร์อะค่ะ

แต่ตอนนี้มันส่งได้แค่เบอร์เดียว แต่เช็คจำนวนลูปแล้วว เบอร์มันก้ออกมาตามที่ query แต่มันส่งได้แค่เบอร์เดียวอะค่ะ

โค๊ดเปนแบบนี้อะค่ะ

<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<?
include("../../config/connect.php");
include("../../config/config.php");
include("../../config/func.inc.php");


if($_POST['status1']=='enter'){
$sql_data="select * from register where send='1' order by id";
$result_data=get_rsltset($sql_data);
$nr_data=count($result_data);


$user="xxxxxx";
$pass="xxxxxx";
$message=$_POST["detail"];
$message=urlencode($message);

$numsms=0;
for($i=0;$i<$nr_data;$i++){
$num=$i+1;
if($numsms >4){sleep(10);$numsms =0;}

$address = "www.sbuysms.com/sms_api.php";
$data = "Username=" . $user . "&Password=" . $pass . "&Text=" . $message . "&PhoneNumber=" .$result_data[$i]['m_phone'];

$numsms++;
}
$ch = curl_init(); // curl
curl_setopt($ch,CURLOPT_URL,"http://$address");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$status = curl_exec($ch); // return
curl_close($ch);


echo"<script language=\"JavaScript\">window.parent.uploadok2('ok');</script>";
exit;
}
?>



ช่วยแนะนำทีค่ะ ขอบคุนค่ะ
17 พ.ค. 2553 1 2,133

<?
include ("../../config/connect.php");
include ("../../config/config.php");
include ("../../config/func.inc.php");

if ($_POST['status1'] == 'enter') {
$sql_data = "select * from register where send='1' order by id";
$result_data = get_rsltset($sql_data);
$nr_data = count($result_data);
$user = "xxxxxx";
$pass = "xxxxxx";
$message = $_POST["detail"];
$message = urlencode($message);
$numsms = 0;
$address = "www.sbuysms.com/sms_api.php";
for ($i = 0; $i < $nr_data; $i++) {
$num = $i + 1;
if ($numsms > 4) {
sleep(10);
$numsms = 0;
}
$data = "Username=".$user."&Password=".$pass."&Text=".$message."&PhoneNumber=".$result_data[$i]['m_phone'];
$numsms++;
$ch = curl_init(); // curl
curl_setopt($ch, CURLOPT_URL, "http://$address");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$status = curl_exec($ch); // return
curl_close($ch);
}
echo "<script language=\"JavaScript\">window.parent.uploadok2('ok');</script>";
exit;
}
?>
 
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^