1、获取天气怎么老是英文的,是不是google 不行了?  http://www.google.com/ig/api?weather=shenzhen2、还有就是 自动根据IP显示相应的问题?<?php
$content = file_get_contents("http://www.google.com/ig/api?weather=shenzhen");
$content = mb_convert_encoding($content, 'gb2312', 'UTF-8');
$xml = simplexml_load_string($content);
//$xml = simplexml_load_file("http://www.google.com/ig/api?weather=hangzhou&hl=zh-cn");
$current = $xml->weather->current_conditions;
$wt['today']['condition'] = $current->condition->attributes(); //天气
$wt['today']['temp_f'] = $current->temp_f->attributes(); //华氏温度
$wt['today']['temp_c'] = $current->temp_c->attributes(); //摄氏温度
$wt['today']['humidity'] = $current->humidity->attributes(); //湿度
$wt['today']['wind_condition'] = $current->wind_condition->attributes(); //风向
$wt['today']['icon'] = $current->icon->attributes();//图标/*
$current = $xml->weather->current_conditions;
     $wt['today']['condition'] = $current->condition->attributes(); //天气
echo $wt['today']['temp_f'] = $current->temp_f->attributes()."华氏温度<br>"; //华氏温度
     $wt['today']['temp_c'] = $current->temp_c->attributes(); //摄氏温度
echo $wt['today']['humidity'] = $current->humidity->attributes()."湿度<br>"; //湿度
echo $wt['today']['wind_condition'] = $current->wind_condition->attributes()."风向<br>"; //风向
     $wt['today']['icon'] = $current->icon->attributes();//图标
echo "<img src=http://www.google.com{$wt['today']['icon']} /><br />";//图标*/
$forecast = $xml->weather->forecast_conditions;            
foreach($forecast as $fc){
        $s++;
        $wt[$s]['low'] = $fc->low->attributes().'-----';
        $wt[$s]['high'] = $fc->high->attributes();
        $wt[$s]['icon'] = $fc->icon->attributes();
        $wt[$s]['condition'] = $fc->condition->attributes();
        $wt[$s]['day_of_week'] = $fc->day_of_week->attributes();
}
//print_r($wt['today']);
echo "<h3>实时天气</h3>";
foreach($wt['today'] as $a=>$b){
      //  echo $a."&nbsp;".iconv('gb2312', 'UTF-8',$b)."<br />";
}
echo "<img src=http://www.google.com{$wt['today']['icon']} /><br />";
echo $wt[1]['low']."&deg;~".$wt[1]['high']."&deg;";
echo "<h3>今天天气</h3>";
foreach($wt[1] as $c=>$d){
        echo $c."&nbsp;".iconv('gb2312', 'UTF-8',$d)."<br />";
}echo $wt[1]['low'] .'-----';
echo "<img src=http://www.google.com{$wt[1]['icon']} />";echo "<img src=http://www.google.com{$wt[2]['icon']} />";
echo "<img src=http://www.google.com{$wt[3]['icon']} />";
echo "<img src=http://www.google.com{$wt[4]['icon']} />";print_r($wt[1]);
?>