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
Post a Comment