embedding the weather conditions

Discussion in 'PHP' started by crazy.works, Feb 17, 2009.

  1. #1
    hello,
    i wanna embed the weather conditions in my site , so is there any way for embedding it from Google or yahoo maybe or any where ???


    thanks
     
    crazy.works, Feb 17, 2009 IP
  2. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #2
    Grab a weather related RSS feed (most weather sites have feeds), and then use an RSS parser to invisibly incorporate it into your site.

    I use lastRSS, but there are plenty of others.

    Working out how to get RSS feeds into your site is worth doing.
     
    Kerosene, Feb 17, 2009 IP
  3. vidgod

    vidgod Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    weather [dot] com has rss feeds that you can use
     
    vidgod, Feb 17, 2009 IP
  4. websecrets

    websecrets Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    htttp://xml.weather.yahoo.com/forecastrss?p=[zipcodgoeshere]

    You can even just throw that in an IFrame if you want.
     
    websecrets, Feb 17, 2009 IP
  5. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks alot
     
    crazy.works, Feb 17, 2009 IP
  6. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    please can i got the full rss code to display each weather data alone in variables like the Temperature in variable , humidity in other one, and ..... ??

    so please ca i do that ?
     
    crazy.works, Feb 17, 2009 IP
  7. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ello,
    i was trying to embed the weather data into my site , i got
    the code but it works for the title and the descriptions only and it
    didnt work for the other data like the
    city,region,timezone,sunrise,sunset,...... the all of the other things
    didnt work . so here is my code and please tell me why it didnt work

    
    
    <?
    
    $feed_url = "http://weather.yahooapis.com/forecastrss?p=94089&u=c";
    
    $curl = curl_init();
    
    curl_setopt($curl, CURLOPT_URL,"$feed_url");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
    
    $xmlTwitter = curl_exec($curl);
    
    curl_close($curl);
    
    $xml = simplexml_load_string($xmlTwitter);
    
    
    foreach ($xml->channel as $channel ){
    $title = $channel->item->title;
    $description = $channel->item->description;
    $city = $channel->item->city;
    $acttemp = $channel->item->acttemp;
    $sunrise = $channel->item->sunrise;
    
    }
    
    
    echo "1-- ".$title;
    echo "<br>";
    echo "2-- ".$city;
    echo "<br>";
    echo "3-- ".$acttemp;
    echo "<br>";
    echo "4-- ".$sunrise;
    echo "<br>";
    
    ?>
    
    
    PHP:
    please guys i wanna display the all data like High temp, low temp, Sunset, Sunrise, Wind, Visibilit, Humidity, Feels Like.....and the same for the next days too. with no loaders or scripts , just simple code like the one i got .

    please guys any help :(
     
    crazy.works, Feb 19, 2009 IP