Welcome to WebmasterWorld Guest from 54.163.52.98

Forum Moderators: bill & werty

Message Too Old, No Replies

Picking apart the "description"

How can this be done?

     

neophyte

9:25 am on Jun 19, 2005 (gmt 0)

10+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month