0

I have question about RSS yahoo weather forecast.

My case : How Get temp in rss yahoo weather forecast?

my code: I loop:

$current = $item->xpath('yweather:condition');<br>
 $forecast = $item->xpath('yweather:forecast');<br>
end loop

{$forecast[0]['day']} - {$forecast[0]['date']} -  {$forecast[0]['text']}. High: {$forecast[0]['high']} Low: {$forecast[0]['low']} || Code :{$forecast[0]['code']}

but for {$forecast[0]['temp']} not work.

Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
b4dQuetions
  • 1,549
  • 6
  • 18
  • 28

1 Answers1

0

On the Yahoo Forecast the "temp" tag shows only for the current day.

<yweather:condition text="Mostly Cloudy" code="26" temp="57" date="Tue, 29 Nov 2005 3:56
      pm PST"></yweather:condition>

You should change your code for this one to show the current temperature:

{$current[0]['temp']}

Also if you want to show the upcoming day's temperatures you should use the "high" and "low" tags only. Check example:

      <yweather:forecast day="Tue" date="29 Nov 2005" low="45" high="62" text="Mostly Cloudy"
      code="27"></yweather:forecast>
  <yweather:forecast day="Wed" date="30 Nov 2005" low="52" high="60" text="Mostly Cloudy"
      code="28"></yweather:forecast>