Jump to content

Parse XML and find a <tag>


willpower

Recommended Posts

Hi

 

I have used a webservice to obtain the follwoing XML response.

 

  <?xml version="1.0" encoding="utf-8" ?> 
  <string xmlns="http://www.webserviceX.NET"><?xml version="1.0" encoding="utf-16"?> <CurrentWeather> <Location>Antalya, Turkey (LTAI) 36-42N 030-44E 57M</Location> <Time>Feb 26, 2007 - 06:20 AM EST / 2007.02.26 1120 UTC</Time> <Wind> from the SE (140 degrees) at 9 MPH (8 KT) (direction variable):0</Wind> <Visibility> greater than 7 mile(s):0</Visibility> <SkyConditions> partly cloudy</SkyConditions> <Temperature> 64 F (18 C)</Temperature> <DewPoint> 50 F (10 C)</DewPoint> <RelativeHumidity> 59%</RelativeHumidity> <Pressure> 29.85 in. Hg (1011 hPa)</Pressure> <Status>Success</Status> </CurrentWeather></string> 

 

Now thats a bit too much info for my liking...All I wanted was perhaps the <SkyConditions> the<Temperature> and maybe <time>

 

When I have used other services I have had the response in an array, allowing me to return the key/value, but this comes as is.

 

How can I catch the variables within tags of my choice and ignore the others?

 

Hope you guys can help.

 

Will

Link to comment
https://forums.phpfreaks.com/topic/40159-parse-xml-and-find-a/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.