新浪天气预报API

新浪天气预报API 很实用
返回是xml文件 utf8字符编码

//// xml 解析提取内容

$xml = new DOMDocument();
//新浪天气接口 返回是xml格式 编码为utf-8
$xml->load('http://php.weather.sina.com.cn/xml.php?city=%B1%B1%BE%A9&password=DJOYnieT8234jlsK&day=0');

foreach($xml->getElementsByTagName('status1') as $list)
{
$tq = $list->firstChild->nodeValue;

}
$strtq = iconv("UTF-8", "GB2312//IGNORE", $tq);

标签: none

评论已关闭