How to get Yahoo Weather API Forecast Information

Discussion in 'PHP' started by muiomuio, Oct 26, 2008.

  1. #1
    I searched the forum but did not find any particular thread with this.

    I am following PHPToys tutorial to retrieve Yahoo weather information.

    Now I want to add forecast information. In the RSS file the information is displayed like this:

    <yweather:forecast day="Sun" date="26 Oct 2008" low="9" high="19" text="Sunny" code="32" />

    This is the PHP code I have to get information:

    
            $spos = strpos($wrss,'yweather:forecast text=" ')+strlen('yweather:forecast text="');
            $epos = strpos($wrss,'"',$spos);
            if ($epos>$spos){
                $atmosfera = substr($wrss,$spos,$epos-$spos);
            } 
    
    Code (markup):
    On the first line if I do yweather:forecast day=" this will get me the current day information but if i want to get the text="Sunny" variable it does not work.

    So how may I retrieve more information of a given string?
     
    muiomuio, Oct 26, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Barti1987, Oct 26, 2008 IP
  3. six.sigma

    six.sigma Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    six.sigma, Oct 31, 2008 IP
  4. muiomuio

    muiomuio Active Member

    Messages:
    225
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    83
    #4
    Thanks, I understand a litle spanish i think i'll handle it :)
     
    muiomuio, Nov 1, 2008 IP
  5. svarya

    svarya Active Member

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    93
    #5
    Thanks dude
     
    svarya, Jul 15, 2009 IP
  6. Twity

    Twity Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ive seen also this API on this site www.philjobspot.com, and I want to know how did they implement it in Ajax. Any Idea?
     
    Twity, Nov 25, 2009 IP