SMS API与MySQL集成 [英] SMS API integration with MySQL

查看:107
本文介绍了SMS API与MySQL集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向联系人位于我的MySQL数据库中的人发送短信.连接已正确建立,但问题是当我使用标头函数调用API URL时,仅将SMS发送给第一联系人.然后页面被重定向到新页面,循环停止.我正在附加脚本,请检查并告知我.

I want to send SMS to people whose contacts lies in my database of MySQL. Connection is established correctly, but the problem is that when i use header function for calling the API URL only SMS is sent to 1st contact. Then the page is redirected to new page and loop stops. I am attaching the script check this and let me know.

<?php <br mode="hold" /?>$con=mysql_connect("localhost","root","");
if(!$con)
        {
            die('Could not connect:'.mysql_error());
        }
          mysql_select_db("gtu_results",$con);

$query="select sem_6.`first_name`,sem_6.`middle_name`,sem_6.`last_name`,sem_6.`enrollment_no`,sem_6.`email_id`,sem_6.`contact_no`,student_marks.`WAD`,
student_marks.`TOC`,student_marks.`SE`,student_marks.`Info_Sec`,student_marks.`OSD`,student_marks.`CG` 
from sem_6 inner join student_marks on sem_6.`enrollment_no`=student_marks.`enrollment_no`";

$result=mysql_query($query);
$n=mysql_num_rows($result);

for($i=0;$i<$n;$i++)						

{

    $row=mysql_fetch_array($result);

    extract($row);



$name= "Name :".$row['first_name']." ".$row['middle_name']." ".$row['last_name']."%0A";



$msg = $name."Enroll No.: ".$row['enrollment_no']."%0A"."SE : ".$row['SE']."%0A"."WAD : ".$row['WAD']."%0A".

"OSD : ".$row['OSD']."%0A"."CG : ".$row['CG']."%0A"."IS : ".$row['Info_Sec']."%0A"."TOC : ".$row['TOC']."%0A";

$mob=$row['contact_no'];



header("Location: http://203.88.133.98/MoreSms.aspx?uid=<user_id>&pwd=<password>&mobiles=$mob&message=$msg ");
//    Problem might be somewhere arround here
}

?>

推荐答案

con = mysql_connect("localhost","root","); if(!
con=mysql_connect("localhost","root",""); if(!


con) { die('无法连接:'.mysql_error()); } mysql_select_db("gtu_results",
con) { die('Could not connect:'.mysql_error()); } mysql_select_db("gtu_results",


con);


这篇关于SMS API与MySQL集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆