<?php
include("class.Chinese.php"); #导入字符集转换的类
$codeTableDir = "./config/"; #指定字符码表的路径
$url = "http://mimg.163.com/tianqi/city/".$_GET['city'].".html"; #获取城市代码,组成完整的URL
$fh = fopen($url,'r'); #读取该URL获取内容
while(!feof($fh)){
$content .= fread($fh,128); #读取全部内容
}
$content = new Chinese("GB2312","UTF8",$content,$codeTableDir); #转换字符码,GB转UTF8
$content = $content->ConvertIT(); #转换
eregi('(<span class="wetCityName">)([^/]*)(</span>)',$content,$arr); #找出表示城市的内容
$city = $arr[2];
eregi('(<span class="wetDate">)(.*)(</span></div>)',$content,$arr); #找出表示日期的内容
$date = $arr[2];
$wea = split('txtAlgCen fRig handle',$content); #分开今天与明天
eregi('(<div class="wetSts">)([^<]*)(</div>)',$wea[0],$arr); #找出表示今日天气的内容
$info1 = $arr[2];
eregi('(<div class="wetSts">)([^<]*)(</div>)',$wea[1],$arr); #找出表示明日天气的内容 下同
$info2 = $arr[2];
eregi('(</b>)([^<]*)(</div>)',$wea[0],$arr);
$temp1 = $arr[2];
eregi('(</b>)([^<]*)(</div>)',$wea[1],$arr);
$temp2 = $arr[2];
eregi('(class="wetDico )(.*)("></div>)',$wea[0],$arr);
$pic1 = $arr[2];
eregi('(class="wetDico )(.*)("></div>)',$wea[1],$arr);
$pic2 = $arr[2];
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
echo "\n";
?>
<weather>
<city><?= $city ?></city>
<date><?= $date ?></date>
<today>
<wea><?= $info1 ?></wea>
<temp><?= $temp1 ?></temp>
<pic><?= $pic1 ?></pic>
</today>
<tomorrow>
<wea><?= $info2 ?></wea>
<temp><?= $temp2 ?></temp>
<pic><?= $pic2 ?></pic>
</tomorrow>
</weather>
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
天气显示(flex+php).rar (21个子文件)
weather.php 2KB
weather
.project 470B
bin
weather.html 4KB
AC_OETags.js 8KB
history.js 1KB
weather-debug.html 4KB
playerProductInstall.swf 657B
history.htm 1KB
history.swf 3KB
weather-debug.swf 389KB
weather.swf 252KB
weather.mxml 16KB
.settings
org.eclipse.core.resources.prefs 88B
.actionScriptProperties 2KB
html-template
AC_OETags.js 8KB
history.js 1KB
index.template.html 4KB
playerProductInstall.swf 657B
history.htm 1KB
history.swf 3KB
.flexProperties 109B
共 21 条
- 1
davidle
- 粉丝: 1
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1