Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 10 of 10

Thread: RSS feeds

  1. #1
    DNF Addict
    seeker's Avatar
    Join Date
    Jun 2003
    Location
    Athens
    Posts
    4,204
    DNF$
    7,642
    Bank
    0
    Total DNF$
    7,642
    Donate  

    RSS feeds

    Anyone know where I can get a complete resource as to what an RSS feed is (I know a little, not enough), and how one can incorporate it into a site...etc...?

    I gogled it, but too much info, and not a how to etc...

    Much appreciated.
    Seek... And you shall Find

  2. #2
    Platinum Lifetime Member
    Ross1982's Avatar
    Join Date
    Aug 2004
    Location
    England
    Posts
    693
    DNF$
    818
    Bank
    0
    Total DNF$
    818
    Donate  

    Re: RSS feeds

    It's just a news feed that lists the news or sporting results etc etc into a java scroller type thing, to install it I think it's just a copy and paste job.

  3. #3
    DNF Addict
    seeker's Avatar
    Join Date
    Jun 2003
    Location
    Athens
    Posts
    4,204
    DNF$
    7,642
    Bank
    0
    Total DNF$
    7,642
    Donate  

    Re: RSS feeds

    mmmm, in google I get all kind of results.
    Seek... And you shall Find

  4. #4
    Exclusive Lifetime Member
    theparrot's Avatar
    Join Date
    Mar 2004
    Posts
    641
    DNF$
    36,543
    Bank
    0
    Total DNF$
    36,543
    Donate  

    Re: RSS feeds

    An RSS feed is supposed to be an XML file that meets the RSS dtd. Problem is it developed more ad hoc then it should have so there are more then one DTD for RSS that are not really compatible. So many just use regexps to parse them. ATOM is suppoed to be the format to fix this. I think that the concept itself it flawed and should be replaced.

    In any case, what you need is a snippet of code to transform the rss/xml to html or whatever output format you desire. If you can't find something by tonight when I am back home I can probably dig something off my HD for you.

  5. #5
    DNF Addict
    seeker's Avatar
    Join Date
    Jun 2003
    Location
    Athens
    Posts
    4,204
    DNF$
    7,642
    Bank
    0
    Total DNF$
    7,642
    Donate  

    Re: RSS feeds

    would really appreciate it.

    I am lost in the maze, and would love to have live feeds for some sites.
    (as painlessly as possible)

    Thanks!
    Seek... And you shall Find

  6. #6
    Bloody Hell
    Acro's Avatar
    Join Date
    Feb 2004
    Location
    USA
    Posts
    28,665
    Country

    Holy See
    DNF$
    15,555
    Bank
    0
    Total DNF$
    15,555
    Donate  

    Re: RSS feeds

    Ela Seeker. I have an instant RSS solution for Yahoo! feeds if your sites are on Windows servers. It might take a while to convert it to unix/linux servers.

    DomainGang.com - Digital Entertainment for Domainers
    Acroplex - Web & Graphics
    Acro.net - My Blog

  7. #7
    DNF Addict
    Nexus's Avatar
    Join Date
    Sep 2002
    Location
    Boston, MA
    Posts
    1,507
    DNF$
    2,143
    Bank
    0
    Total DNF$
    2,143
    Donate  

    Thumbs up Re: RSS feeds

    Quote Originally Posted by RADiSTAR
    Ela Seeker. I have an instant RSS solution for Yahoo! feeds if your sites are on Windows servers. It might take a while to convert it to unix/linux servers.
    The folowing code has served me extremely well. It parses through XML content, and sends you an array you can pull data out of.
    Code:
    function GetXMLTreeData($data) 
    { 
      $parser = xml_parser_create('ISO-8859-1');
    // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 
      xml_parse_into_struct($parser, $data, $vals, $index); 
      xml_parser_free($parser); 
    
      $tree = array(); 
      $i = 0; 
      
      if (isset($vals[$i]['attributes'])) {
        $tree[$vals[$i]['tag']]['ATTRIBUTES'] = $vals[$i]['attributes']; 
        $tree[$vals[$i]['tag']][] = GetChildren($vals, $i);
      }
      else
        $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 
      
      return $tree; 
    } 
    
    function GetChildren($vals, &$i) 
    { 
      $children = array();     // Contains node data
      
      /* Node has CDATA before it's children */
      if (isset($vals[$i]['value'])) 
        $children['VALUE'] = $vals[$i]['value']; 
      
      /* Loop through children */
      while (++$i < count($vals))
      { 
        switch ($vals[$i]['type']) 
        { 
          /* Node has CDATA after one of it's children 
            (Add to cdata found before if this is the case) */
          case 'cdata': 
            if (isset($children['VALUE']))
              $children['VALUE'] .= $vals[$i]['value']; 
            else
              $children['VALUE'] = $vals[$i]['value']; 
            break;
          /* At end of current branch */ 
          case 'complete': 
            if (isset($vals[$i]['attributes'])) {
              $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
              $index = count($children[$vals[$i]['tag']])-1;
    
              if (isset($vals[$i]['value'])) 
                $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; 
              else
                $children[$vals[$i]['tag']][$index]['VALUE'] = ''; 
            } else {
              if (isset($vals[$i]['value'])) 
                $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; 
              else
                $children[$vals[$i]['tag']][]['VALUE'] = ''; 
    		}
            break; 
          /* Node has more children */
          case 'open': 
            if (isset($vals[$i]['attributes'])) {
              $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
              $index = count($children[$vals[$i]['tag']])-1;
              $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i));
            } else {
              $children[$vals[$i]['tag']][] = GetChildren($vals, $i);
            }
            break; 
          /* End of node, return collected data */
          case 'close': 
            return $children; 
        } 
      } 
    } 
    
    function array_detail($obj) {
      global $__level_deep;
      if (!isset($__level_deep)) $__level_deep = array();
    
      if (is_object($obj))
        print '[obj]';
      elseif (is_array($obj)) {
        foreach(array_keys($obj) as $keys) {
          array_push($__level_deep, "[".$keys."]");
          printa($obj[$keys]);
          array_pop($__level_deep);
        }
      }
      else print implode(" ",$__level_deep)." = $obj";
    }
    I've used this code to pull results from different RSS sources. Just use the "print_r" function in php to see what you got, and just refer to whichever node you need.

    Here's some code to READ the RSS from a remote server, and save the latest feed locally as a text document (so you're not pull the RSS every time someone views your page):
    Code:
    $url = "http://rss.topix.net/rss/food/dieting.xml";
    $url = parse_url($url);
    
    $sock = fsockopen($url["host"],"80",$errno,$error);
    if (!$sock)
    {
      echo ("<b>Could Not Connect To Server.</b> ERROR No.: <I>$errno</I> | ERROR: <i>$error</i>");
      exit;
    }$result = "";
    
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    
    $header = "";
    $header .= "GET ".$url["path"]." HTTP/1.0\r\n";
    $header .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg\r\n";
    $header .= "Accept-Language: en-us\r\n";
    $header .= "Host: ".$url["host"]."\r\n";
    $header .= "User-Agent: $useragent\r\n";
    $header .= "\r\n\r\n";
    
    fputs($sock,$header);
    $getcontent = 0;
    while(!feof($sock)){
     if($getcontent<1 && $result!="\r\n") 
      $result = fgets($sock,128);
     else 
      {
       if($getcontent<1)$result="";
       $result .= fgets($sock,128);
       $getcontent++;
      }
    }
    fclose($sock);
    
    $filename = "dieting.xml";
    // Let's make sure the file exists and is writable first.
    if (!file_exists($filename)||is_writable($filename)) {
    
       // In our example we're opening $filename in append mode.
       // The file pointer is at the bottom of the file hence 
       // that's where $result will go when we fwrite() it.
       if (!$handle = fopen($filename, 'w+')) {
             echo "Cannot open file ($filename)";
             exit;
       }
    
       // Write $result to our opened file.
       if (fwrite($handle, $result) === FALSE) {
           echo "Cannot write to file ($filename)";
           exit;
       }
       
       echo "Success, wrote ($result) to file ($filename)";
       
       fclose($handle);
                       
    } else {
       echo "The file $filename is not writable";
    }
    print "<hr>";
    print $result;
    Finally, this code will READ the XML formatted document (using the functions I first quoted above), and display the results in HTML...
    Code:
    $output = file("newsfeed/dieting.xml");
    $output = implode("",$output);
    
    //In Case of Problem
    if(!$output){$output = file("newsfeed/dieting_backup.xml");$output = implode("",$output);}
    
    require_once('./newsfeed/functions_extra.php');
    $output = GetXMLTreeData($output);
    
    $feed = $output["RDF:RDF"][0]["ITEM"];
    
    $newsfeed = "";
    foreach($feed as $nf){
     //TITLE,LINK,DESCRIPTION
     $newsfeed .= "<a href=\"".$nf["LINK"][0]["VALUE"]."\" style=\"font-size:12px;color:#000000;\"><b>".$nf["TITLE"][0]["VALUE"]."</b></a><br>";
     $newsfeed .= "<small style=\"font-size:11px;color:#000000;\">".$nf["DESCRIPTION"][0]["VALUE"]."</small><br><br>";
    }
    
    $newsfeed = "<table cellpadding=10 cellspacing=0 border=0><tr><td>".addslashes($newsfeed)."</td></tr></table>";
    You'll have to crawl through the details, but once it makes sense, you'll pretty much be unstoppable with grabbing RSS feeds. You just have to know a little PHP.

    For a more "packaged" solution, here's a moldy oldey that you might be able to modify to your own needs.
    http://www.dansteinman.com/php/pheadlines/

    DEMO:
    http://www.dansteinman.com/php/phead...headlines.php3

    This bad boy works like a charm, caches results, but... I'm not sure how up-to-date it is (and doesn't show examples from Yahoo's feeds).

    Cheers,
    ~ Nexus
    FreeWho.com - Free Internet Tools!

  8. #8
    Former DNF Admin
    MediaHound's Avatar
    Join Date
    Feb 2004
    Location
    Florida
    Posts
    4,896
    Blog Entries
    1
    DNF$
    15,980
    Bank
    0
    Total DNF$
    15,980
    Donate  

    Re: RSS feeds

    My friend Alex, here's some RSS resources that I use:
    http://www.rssforums.com
    http://forum.free-templates.com/forumdisplay.php?f=34

  9. #9
    DNF Addict
    seeker's Avatar
    Join Date
    Jun 2003
    Location
    Athens
    Posts
    4,204
    DNF$
    7,642
    Bank
    0
    Total DNF$
    7,642
    Donate  

    Re: RSS feeds

    Thanks everyone!!!

    excellent resources, codes, and links. I apprciate it.
    Seek... And you shall Find

  10. #10
    Gold Lifetime Member
    schmidte's Avatar
    Join Date
    Nov 2002
    Location
    Illinois
    Posts
    377
    DNF$
    824
    Bank
    0
    Total DNF$
    824
    Donate  

    Re: RSS feeds

    Here's a site I use that will generate a code for just about any news subject, you can customize with style sheets.
    ED

    http://anyrss.maquis.org/

Similar Threads

  1. data Feeds added to dnforum.com
    By Adam Dicker in forum Forum Announcements
    Replies: 20
    Last Post: 03-30-2005, 11:21 AM
  2. help - live feeds?
    By iBizStart in forum Website Development and Design Discussion
    Replies: 3
    Last Post: 02-14-2004, 10:50 AM
  3. Replies: 14
    Last Post: 07-17-2003, 06:18 PM
  4. Free java script news feeds...
    By biggedon in forum Website Development and Design Discussion
    Replies: 9
    Last Post: 10-13-2002, 04:04 PM
  5. Info Feeds
    By HLK in forum Website Development and Design Discussion
    Replies: 3
    Last Post: 08-19-2002, 09:28 PM

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
  •  

Domain name forum recommended by Domaining.com