?? weather.cgi
字號:
#!/usr/bin/perl
# 請修改下面圖片目錄設置(可別調用我的啊)
$imgurl="http://www.flyao.com/cgi-bin/weather/images/";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday)= localtime(time+(3600*$time_hour));
$mon=$mon+1;
if($mon <10){$mon="0".$mon;}
if($mday<10){$mday="0".$mday;}
if($hour<10){$hour="0".$hour;}
if($min<10){$min="0".$min;}
if($sec<10){$sec="0".$sec;}
$year=$year+1900;
$real_time="$year$mon$mday";
$date="$year年$mon月$mday日";
$jsfile="/usr/home/uk21g1/htdocs/weather/$real_time.js";
# 下面這一項請填寫你的絕對路徑。(如果是win系統的話,其它的系統直接填文件名)
require "E:/flyao/cgi-bin/weather/gethtml.cgi";
print "Content-type: text/html\n\n";
$dispcity=$ENV{'QUERY_STRING'};
$city_china=&gethtml('http://www.cctv.com/weather/city_china.js');
$pollution=&gethtml('http://www.cctv.com/weather/pollution.js');
$pollution=~s/\n//g;
@pcitylist=split(';',$pollution);
foreach(@pcitylist) {
if (($_ !~/Array/)&&($_ =~ /(\'(.*))/i)) {
$v=$1;
$v=~s/'//g;
$v=~s/\)/,/g;
$v=~s/,,/,/g;
push(@pdata,$v);
}
}
$city_china=~s/\n//g;
@citylist=split('=new today_',$city_china);
foreach(@citylist) {
if (($_ !~/中央氣象臺城市天氣預報/)&&($_ =~ /(\'(.*));/i)) {
$v=$1;
$v=~s/'//g;
$v=~s/\)/,/g;
$v=~s/,,/,/g;
push(@data,$v);
}
}
# 下面這一項請填寫你的絕對路徑。(如果是win系統的話,其它的系統直接填文件名)
open(TMP,"E:/flyao/cgi-bin/weather/weather.txt");
@weather=<TMP>;
close(TMP);
print <<EOF;
<marquee scrollamount=1 scrolldelay=60 width=100% height=15 onmouseover='this.stop()' onmouseout='this.start()'>
EOF
$outstrs='';
foreach(@data) {
($city,$x,$y,$wer,$wu,$wd,$fx)=split(',',$_);
($id,$cweather,$imgname)=split(',',$weather[$wer-1]);
$kq='';
$wr='';
foreach(@pdata) {
($city1,$kq1,$wr1)=split(',',$_);
if($city1 eq $city) { $kq=$kq1; $wr=$wr1; }
}
$imgname=~s/images\///isg;
if($wr eq "") {$wr="無"; }
if($city eq "北京") {
unless(-f "$jsfile") {
open(js,">$jsfile");
print js "$date北京市天氣預報:$cweather,最高溫度$wu,最低溫度$wd,空氣質量$kq,首要污染物為$wr。";
close(js);
}
}
print <<EOF;
<span style="font size:9pt"> $city:<img src=\"$imgurl$imgname\" width=17 height=17>$cweather
EOF
}
print <<EOF;
<marquee>
EOF
exit;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -