天气预报 goolge api 写法
//天气预报
$weather_xml = file_get_contents('http://www.google.com/ig/api?weather=guangzhou');
$xml = simplexml_load_string($weather_xml);
$xml->forecast_information->city->attributes; //读一个节点的属性
$wea['city'] = $xml->weather->forecast_information->postal_code->attributes()->data; //天气预报地区
$wea['condition'] = $xml->weather->current_conditions->condition->attributes()->data; //多云
$wea['humidity'] = $xml->weather->current_conditions->humidity->attributes()->data; //湿度
$wea['icon'] = $xml->weather->current_conditions->icon->attributes()->data; //图标
$wea['wind_condition'] = $xml->weather->current_conditions->wind_condition->attributes()->data; //湿度
前望