Link to home
Start Free TrialLog in
Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal

asked on

Php get information from xml data

Hi E's, I want use Goggle Weather Api in php.
For make a query to the API I use this URL: http://www.google.com/ig/api?weather= + the name of the city.
The result was:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<forecast_information>
<city data="Ayamonte, Andalusia"/>
<postal_code data="ayamonte"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2012-04-11"/>
<current_date_time data="1970-01-01 00:00:00 +0000"/>
<unit_system data="SI"/>
</forecast_information>
<current_conditions>
<condition data="Limpo"/>
<temp_f data="61"/>
<temp_c data="16"/>
<humidity data="Humidade: 68%"/>
<icon data="/ig/images/weather/sunny.gif"/>
<wind_condition data="Vento: O a 24 km/h"/>
</current_conditions>
<forecast_conditions>
<day_of_week data="qua"/>
<low data="10"/>
<high data="23"/>
<icon data="/ig/images/weather/sunny.gif"/>
<condition data="Limpo"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="qui"/>
<low data="8"/>
<high data="20"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Possibilidade de chuva"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="sex"/>
<low data="10"/>
<high data="22"/>
<icon data="/ig/images/weather/sunny.gif"/>
<condition data="Limpo"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="sáb"/>
<low data="10"/>
<high data="21"/>
<icon data="/ig/images/weather/mostly_sunny.gif"/>
<condition data="Parcialmente nublado"/>
</forecast_conditions>
</weather>
</xml_api_reply>

Open in new window


If I want get from xml result all "<low data"  and all "<high data" and put them in the arrays $lowdata and highdata, how I do?

The best regards, JC
ASKER CERTIFIED SOLUTION
Avatar of chrisroch
chrisroch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial