tutorialstuff Posted January 25, 2010 Share Posted January 25, 2010 I'm trying to extract the data and place them into variables from the below xml document from the line that says :<day0 name="Monday" date="01/25" max="50" min="41" code="13" phrase="Showers"/> basically I would like it to be like $name=Monday, $max=50 etc... I'm not sure if this would be a job for preg_match or something else and if so, what would be the best way to do this? Thanks for any help! <data> <provider>qwikcast.com</provider> <date>01/25/2010</date> <time>11:05</time> <loc city="Longview" state="WA" country="US" county="Cowlitz" lat="46.1300" lon="-122.9300" elev="21"/> <icon dir="NA"/> − <fcst> <day0 name="Monday" date="01/25" max="50" min="41" code="13" phrase="Showers"/> <day1 name="Tuesday" date="01/26" max="49" min="37" code="12" phrase="PM Showers"/> <day2 name="Wednesday" date="01/27" max="49" min="35" code="2" phrase="Partly Cloudy"/> <day3 name="Thursday" date="01/28" max="51" min="36" code="16" phrase="Light Rain"/> <day4 name="Friday" date="01/29" max="50" min="42" code="16" phrase="Light Rain"/> </fcst> <obs id="KKLS" time="10:35 AM" code="1" phrase="Clear" tempUnit="F" temp="46" appTemp="46" appWord="Apparent" dew="42" rh="87" windSpd="11" windDir="SSE" windUnit="mph" vis="10" visUnit="mi" baro="29.91" baroUnit="in"/> </data> Link to comment https://forums.phpfreaks.com/topic/189781-help-extracting-data/ Share on other sites More sharing options...
jskywalker Posted January 25, 2010 Share Posted January 25, 2010 http://www.php.net/manual/en/simplexmlelement.attributes.php Link to comment https://forums.phpfreaks.com/topic/189781-help-extracting-data/#findComment-1001539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.