php - Get weather code from Yahoo XML response -


i'm looking quick way condition code yahoo php. use woeid code feed city's weather , in xml response, see this:

<yweather:condition text="mostly cloudy" code="28" temp="33" date="tue, 14 may 2013 10:30 ict"/>  

the thing want code (here in example 28), convenient work conditions. simplest way tiny bit of data?

you can using domdocument:

$doc = new domdocument(); @$doc->loadxml('<yweather:condition text="mostly cloudy" code="28" temp="33" date="tue, 14 may 2013 10:30 ict"/>'); $node = $doc->getelementsbytagname('condition'); echo $node->item(0)->getattribute('code');  

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -