文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>根据 MySQL 数据表中日期数据发送值班通知短信的..

根据 MySQL 数据表中日期数据发送值班通知短信的..

时间:2008-11-12  来源:machine

#!/usr/bin/perl -w

use DBI;
use LWP::Simple qw(get);

# $driver="mysql";

$dbh=DBI->connect("DBI:mysql:csunet:localhost","root","")||die"can not connect database";

# 产生当天日期

$year = (gmtime time)[5] + 1900;
$month = (gmtime time)[4] + 1;
$date = (gmtime time)[3];
$today = $year."-".$month."-".$date;

$sql = "select phone from duty_info where RiQi='" .$today. "'";

$sth=$dbh->prepare($sql) || die "Occur an error when query database!";
$sth->execute();
$numRows=$sth->rows;

while(@row=$sth->fetchrow_array)
{
$number = $row[0];
}

if($numRows == 1)
{
my $url = 'http://xxx.xxx.xxx/cgi-bin/csend.exe?N=13687363994,' .$number. '&M=省网7206路由器出现故障请检查';
my $content = get $url;

print $content;
print "\n";
}

print "满足条件的数为: $numRows \n";
print $today;
print "\n";
print $sql;
print "\n";

$sth->finish();
$dbh->disconnect();

exit 0;

相关阅读 更多 +
排行榜 更多 +
别惹神枪手安卓版

别惹神枪手安卓版

冒险解谜 下载
坦克战争世界

坦克战争世界

模拟经营 下载
丛林反击战

丛林反击战

飞行射击 下载