yahoo weather rss feed display using php - rss feed parser class

yahoo weather rss feed display using php - rss feed parser class

yahoo-weather-rss-feed-display-using-php.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>yahoo weather rss feed display using php - rss feed parser class</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="yahoo weather rss feed display using php - rss feed parser class">
  <meta name="keywords" content="php, example, code, rss, function, rss feed, string">
  <meta name="description" content="yahoo weather rss feed display using php - rss feed parser class">
  <style>
   h2, h4{background:#bbb; color:#000095;}
   h2{ padding:3px; margin:3px; font-size:20px;}
   h4{ padding:2px; margin:2px; font-size:16px;}
   p{padding:2px; margin:2px; color:#0099FF;}
   body{ background:#FFFFFa;}
  </style>
 </head>
 <body>
  <h2>yahoo weather rss feed display using php - rss feed parser class</h2>
  <pre>
   <?php
    /*
     ---------------------------------------------------
     let us make the parser class with sort description
     ---------------------------------------------------
    */
    class RSSParser
    {
     var $url;
     var $rssFeed;
     
     function PushURL($url) 
     {
      $this->url = $url;
     }
     function MakeRSSFeed()
     {
      $xmlContainer = simplexml_load_file($this->url);
      $this->rssFeed = "<ul>";
      foreach($xmlContainer->channel->item as $thisItem)
      {
       $this->rssFeed .= "
        <li>
         <a href='{$thisItem->link}' target='_blank'>{$thisItem->title}</a>
         <p>{$thisItem->description}</p>
        </li>
       ";
      }
      $this->rssFeed .= "</ul>";
     }
     function ReturnRSSFeed()
     {
      return $this->rssFeed;
     }
    }
    /*
     --------------------------------------------------------------------------------------------------
     $url is the container of the url to which have to be sucked
     $rssFeed is the feed container created by the instance of the class
     
     function PushURL() is responsible to push the url to the object
     function MakeRSSFeed() is the main function which is responsible to parse the xml file returned
     function ReturnRSSFeed() just return the feed made by the object
     --------------------------------------------------------------------------------------------------
    */
    /*
     --------------------------------------------------------------------------------------------------
     i think it's time to fire up the class to get yahoo weather rss feed
     the url is  http://weather.yahooapis.com/forecastrss?w=location
     where w=location is the location defined by yahoo. for details refer yahoo weather.
     
     for example - 1915031 is the value of chittagong, bangladesh i.e we want weather information of 
     chittagong by using yahoo weather rss api
     --------------------------------------------------------------------------------------------------
    */
    $theURL = 'http://weather.yahooapis.com/forecastrss?w=1915031';
     
    $rssObject = new RSSParser();
    $rssObject->PushURL($theURL);
    $rssObject->MakeRSSFeed();
    
    echo "<h2>Chittagon weather information - yahoo rss feed</h2>";
    echo $rssObject->ReturnRSSFeed();
    /*
     -------------------------------------------------------------------------------------------
     by changing the value of w in the url we can get weather information of any city the world
     for example - w=1915035 is for dhaka
     refer http://weather.yahoo.com to get the value of w of your desire city or town
     -------------------------------------------------------------------------------------------
    */
    
    // just unblock the code to get weather info of dhaka
    
    //$theURL = 'http://weather.yahooapis.com/forecastrss?w=1915035';
    //$rssObject->PushURL($theURL);
    //$rssObject->MakeRSSFeed();
    
    //echo "<h2>dhaka weather information - yahoo rss feed</h2>";
    //echo $rssObject->ReturnRSSFeed();
    
    /*
     ---------------------------------------------------------------------------------------
     yahoo weather api is rapidly used in professional programming to display weather
     information & forecast of city or town.
     ---------------------------------------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>


yahoo weather rss feed display using php - rss feed parser class - output in the browser

5 comments:

  1. thnQ too. feel free to comment what you like or not.

    ReplyDelete
  2. Thank you very much I looking for this. I like it very much.

    ReplyDelete
  3. Thanks Friend, I am looking for this I like it very much

    ReplyDelete
  4. You can setup ad-hoc conversion funnels and apply them to historical data. Therefore, you can compare it to past performance. It is also possible to setup predefined funnels that can be 15 steps deep!
    http://800support.net/gmail-support/change-gmail-username/

    ReplyDelete

leave your comments here..