Results 1 to 5 of 5

Thread: AJAX RSS Reader in PHP

  1. #1
    Join Date
    May 2009
    Posts
    511

    AJAX RSS Reader in PHP

    Hi friends,
    I am designing a web page. I have done coding in PHP along with the AJAX to some extent. Now i want to add the RSS Feeder on my page and so that I want some help from you. I have tried to do different things but not succeeded. So thought that someone would help me to solve my query. Please explain me about the AJAX RSS Reader in PHP.!! Please help me as soon as possible.!!

  2. #2
    Join Date
    Mar 2008
    Posts
    349

    Re: AJAX RSS Reader in PHP

    An RSS Reader is used to read RSS Feeds. That means the user can give the feed back about your webpage. For that purpose the RSS Feeds are used so that you can get an idea accordingly. An RSS document includes full or summarized text, plus metadata such as publishing dates. A standardized XML file format allows the information to be published once and viewed by many different programs. As said before that the user subscribes to a feed by entering into the reader the feed's URI or by clicking an RSS icon in a web browser that initiates the subscription process.

  3. #3
    Join Date
    Mar 2008
    Posts
    672

    Re: AJAX RSS Reader in PHP

    RSS formats are specified using XML, a generic specification for the creation of data formats. You may insert one RSS feed which is having many different versions of it. The specification is an independent draft not supported or endorsed in any way by the RSS-Dev Working Group or any other organization. The most serious compatibility problem is with HTML markup. In order to be usable by other parties, the data to be shared must be in a generic format that can be laid out in different formats than in the original source.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,192

    Re: AJAX RSS Reader in PHP

    The HTML page contains a link to an external JavaScript, an HTML form, and a div element. The following code would be useful for you :
    HTML Code:
    <html>
    <head>
    <script type="demo/javascript" src="getrss.js"></script>
    </head>
    <body>
    
    <form>
    Select an RSS-feed:
    <select onchange="showRSS(this.value)">
    <option value="Google">Google News</option>
    <option value="MSNBC">MSNBC News</option>
    </select>
    </form>
    
    <p><div id="rssOutput">
    <b>RSS-feed will be listed here...</b></div></p>
    </body>
    </html>

  5. #5
    Join Date
    Nov 2008
    Posts
    996

    Re: AJAX RSS Reader in PHP

    The PHP page called by the JavaScript code is called "getrss.php" :
    PHP Code:
    <?php
    $q
    =$_GET["q"];

    if(
    $q=="Google")
      {
      
    $xml=("http://news.google.com/news?ned=us&topic=h&output=rss");
      }
    elseif(
    $q=="MSNBC")
      {
      
    $xml=("http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml");
      }

    $xmlDoc = new DOMDocument();
    $xmlDoc->load($xml);

    $channel=$xmlDoc->getElementsByTagName('channel')->item(0);
    $channel_title $channel->getElementsByTagName('title')
    ->
    item(0)->childNodes->item(0)->nodeValue;
    $channel_link $channel->getElementsByTagName('link')
    ->
    item(0)->childNodes->item(0)->nodeValue;
    $channel_desc $channel->getElementsByTagName('description')
    ->
    item(0)->childNodes->item(0)->nodeValue;

    echo(
    "<p><a href='" $channel_link
      
    "'>" $channel_title "</a>");
    echo(
    "<br />");
    echo(
    $channel_desc "</p>");

    $x=$xmlDoc->getElementsByTagName('item');
    for (
    $i=0$i<=2$i++)
      {
      
    $item_title=$x->item($i)->getElementsByTagName('title')
      ->
    item(0)->childNodes->item(0)->nodeValue;
      
    $item_link=$x->item($i)->getElementsByTagName('link')
      ->
    item(0)->childNodes->item(0)->nodeValue;
      
    $item_desc=$x->item($i)->getElementsByTagName('description')
      ->
    item(0)->childNodes->item(0)->nodeValue;

      echo (
    "<p><a href='" $item_link
      
    "'>" $item_title "</a>");
      echo (
    "<br />");
      echo (
    $item_desc "</p>");
      }
    ?>

Similar Threads

  1. what is ajax?
    By carmelmonteverdeinn in forum Software Development
    Replies: 1
    Last Post: 28-07-2010, 11:34 AM
  2. jQuery AJAX vs. Adobe AIR AJAX Class
    By Agaev in forum Windows Software
    Replies: 5
    Last Post: 06-07-2010, 01:59 PM
  3. What is better (string)reader[0] or Convert.ToString(reader[0])
    By Conraad in forum Software Development
    Replies: 4
    Last Post: 15-02-2010, 09:47 PM
  4. Kindle vs Nook reader vs Sony reader
    By Bon-Z in forum Polls & Voting
    Replies: 5
    Last Post: 14-12-2009, 11:46 PM
  5. What is AJAX in Asp.net ?
    By Braze in forum Software Development
    Replies: 5
    Last Post: 14-01-2009, 06:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,203,948.42584 seconds with 16 queries