homepage Welcome to WebmasterWorld Guest from 54.145.183.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
Picking apart the "description"
How can this be done?
neophyte

10+ Year Member



 
Msg#: 280 posted 9:25 am on Jun 19, 2005 (gmt 0)

I'm doing some testing to bring the local Philippine weather into a clients site via RSS. I've found the feed that I need, and have also found a .php parser that does the job.

So far, so good.

Problem I'm having is the feed that I have spits more information than I need via the description tag. It gives me temperature, cloud levels, barometric pressure and on and on.

All that I want is the temperature. How does one pick apart the description so I get only what I'm interested in?

At the very beginning of the parser there's an $itemNum var which is set to '0'.

Then, the echo code inside the html code targets an array like this: <?php echo $weather->descriptions[$itemNum];?>.

So, if I figure out that the temperature text is the sixth word within the description, for example, and I set $itemNum='6', should I only get the temperature?

Does anyone know if I'm on the right track with this? I'm just guessing, but this seams reasonable.

I also want to find out the weather condition (sunny, partly cloudy, rainy, etc) and get that information so I can pull/display the correct condition icon.

Any and all assistance greatly appreciated.

Neophyte

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved