willpower Posted February 26, 2007 Share Posted February 26, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/40159-parse-xml-and-find-a/ Share on other sites More sharing options...
ToonMariner Posted February 26, 2007 Share Posted February 26, 2007 have a look at simpleXML for php 5 or DOMXML for php 4 (simple is much easier imo). Quote Link to comment https://forums.phpfreaks.com/topic/40159-parse-xml-and-find-a/#findComment-194341 Share on other sites More sharing options...
willpower Posted February 26, 2007 Author Share Posted February 26, 2007 Had a look at these. I am running 4.4.4 with no root access. Keep getting call to undefined...any other ways i can parse this? Will Quote Link to comment https://forums.phpfreaks.com/topic/40159-parse-xml-and-find-a/#findComment-194423 Share on other sites More sharing options...
willpower Posted February 26, 2007 Author Share Posted February 26, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/40159-parse-xml-and-find-a/#findComment-194840 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.