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 8 of 8
  1. #1
    Platinum Lifetime Member
    spietreser's Avatar
    Join Date
    May 2002
    Location
    Oith
    Posts
    872
    DNF$
    942
    Bank
    7,000
    Total DNF$
    7,942
    Donate  

    Arrow Custom news feed

    For a long time now, I have been looking for a way to add a newsfeed to my website that is based on certain keywords. So if the keyword is "wigs", the feed shows news articles that are about wigs.

    Best would be to gather news from Google, Yahoo, etc. If that's not possible, then smaller news feeds are certainly welcome, as long as they are up to date.

    Also, is there a way to include the news text on my website too?

    Thanks in advance for your help!
    spietreser

  2. #2
    Account Terminated
    Join Date
    Aug 2004
    Posts
    450
    DNF$
    1,238
    Bank
    0
    Total DNF$
    1,238
    Donate  

    Re: Custom news feed

    You will have to (im not positive, but pretty sure) do that via the rss feeds from their sites directly:

    here is the rss feed for all that is wigs from google: http://news.google.com/news?hl=en&ne...F-8&output=rss

    rss only posts what they want to share. cnn is frustrating because they only show any text half the time, otherwise it says "click here for more..."
    Last edited by LeeRyder; 05-27-2006 at 03:48 PM. Reason: Automerged Doublepost

  3. #3
    Platinum Lifetime Member
    spietreser's Avatar
    Join Date
    May 2002
    Location
    Oith
    Posts
    872
    DNF$
    942
    Bank
    7,000
    Total DNF$
    7,942
    Donate  

    Re: Custom news feed

    Thank you for the link Lee, it appears to be exactly what I'm looking for

  4. #4
    Account Terminated
    Join Date
    Aug 2004
    Posts
    450
    DNF$
    1,238
    Bank
    0
    Total DNF$
    1,238
    Donate  

    Re: Custom news feed

    your very welcome

    I love RSS and the new Messenger API stuff coming out. I think that API bots are going to be the next being thing in syndication, so hopefully that will help you as well if you decide to grow in that direction as well.

  5. #5
    Platinum Lifetime Member
    spietreser's Avatar
    Join Date
    May 2002
    Location
    Oith
    Posts
    872
    DNF$
    942
    Bank
    7,000
    Total DNF$
    7,942
    Donate  

    Re: Custom news feed

    Hey Lee,
    Sounds cool! I'm interested in knowing what this RSS in combination with Messenger API can do? What is the benefit with API bots, over the current RSS form?
    Thanks in advance for the explanation!

  6. #6
    The Bishop
    namestrands's Avatar
    Join Date
    Jan 2005
    Location
    Langley, VA
    Posts
    4,053
    DNF$
    3,312
    Bank
    0
    Total DNF$
    3,312
    Donate  

    Re: Custom news feed

    I do that very thing you are talking about, using Google RSS.

    PHP Code:
    <?php

    $keyword 
    "wigs"// you could pull the keyword from a database

    set_time_limit(0);

    $file "http://news.google.com/news?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-22,GGLG:en&q=$keyword&output=rss";

    $rss_channel = array();
    $currently_writing "";
    $main "";
    $item_counter 0;

    function 
    startElement($parser$name$attrs) {
           global 
    $rss_channel$currently_writing$main;
           switch(
    $name) {
               case 
    "RSS":
               case 
    "RDF:RDF":
               case 
    "ITEMS":
                   
    $currently_writing "";
                   break;
               case 
    "CHANNEL":
                   
    $main "CHANNEL";
                   break;
               case 
    "IMAGE":
                   
    $main "IMAGE";
                   
    $rss_channel["IMAGE"] = array();
                   break;
               case 
    "ITEM":
                   
    $main "ITEMS";
                   break;
               default:
                   
    $currently_writing $name;
                   break;
           }
    }

    function 
    endElement($parser$name) {
           global 
    $rss_channel$currently_writing$item_counter;
           
    $currently_writing "";
           if (
    $name == "ITEM") {
               
    $item_counter++;
           }
    }

    function 
    characterData($parser$data) {
        global 
    $rss_channel$currently_writing$main$item_counter;
        if (
    $currently_writing != "") {
            switch(
    $main) {
                case 
    "CHANNEL":
                    if (isset(
    $rss_channel[$currently_writing])) {
                        
    $rss_channel[$currently_writing] .= $data;
                    } else {
                        
    $rss_channel[$currently_writing] = $data;
                    }
                    break;
                case 
    "IMAGE":
                    if (isset(
    $rss_channel[$main][$currently_writing])) {
                        
    $rss_channel[$main][$currently_writing] .= $data;
                    } else {
                        
    $rss_channel[$main][$currently_writing] = $data;
                    }
                    break;
                case 
    "ITEMS":
                    if (isset(
    $rss_channel[$main][$item_counter][$currently_writing])) {
                        
    $rss_channel[$main][$item_counter][$currently_writing] .= $data;
                    } else {
                        
    $rss_channel[$main][$item_counter][$currently_writing] = $data;
                    }
                    break;
            }
        }
    }

    $xml_parser xml_parser_create();
    xml_set_element_handler($xml_parser"startElement""endElement");
    xml_set_character_data_handler($xml_parser"characterData");
    if (!(
    $fp fopen($file"r"))) {
        die(
    "could not open XML input");
    }

    while (
    $data fread($fp4096)) {
        if (!
    xml_parse($xml_parser$datafeof($fp))) {
            die(
    sprintf("XML error: %s at line %d",
                        
    xml_error_string(xml_get_error_code($xml_parser)),
                        
    xml_get_current_line_number($xml_parser)));
        }
    }
    xml_parser_free($xml_parser);

    // output HTML
    // print ("<div class=\"channelname\">" . $rss_channel["TITLE"] . "</div>"); 

    if (isset($rss_channel["ITEMS"])) {
        if (
    count($rss_channel["ITEMS"]) > 0) {
            for(
    $i 0;$i count($rss_channel["ITEMS"]);$i++) {
                if (isset(
    $rss_channel["ITEMS"][$i]["LINK"])) {
                print (
    "\n<div class=\"itemtitle\"><a href=\"" "go.php?url=" $rss_channel["ITEMS"][$i]["LINK"] . "\">" $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
                } else {
                print (
    "\n<div class=\"itemtitle\">" $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
                }
                 print (
    "<div class=\"itemdescription\">" $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />");         }
        } else {
            print (
    "<b>There are no articles in this feed.</b>");
        }
    }

    ?>
    Enterprise Communications and Social Media in Uist

  7. #7

  8. #8
    The Bishop
    namestrands's Avatar
    Join Date
    Jan 2005
    Location
    Langley, VA
    Posts
    4,053
    DNF$
    3,312
    Bank
    0
    Total DNF$
    3,312
    Donate  

    Re: Custom news feed

    no problem..

    just as a note of caution if you were to use more than one keyword, for example "wig makers" you would need to change the line

    $keyword = "Your Keywords";

    to

    $keyword = urlencode("your keywords");
    Enterprise Communications and Social Media in Uist

Similar Threads

  1. Submit your articles and news releases easy to RSS feed services
    By TheNetCode in forum Advertising and Related Offers
    Replies: 2
    Last Post: 11-12-2005, 10:50 AM
  2. News RSS Feed Directory - FreeRSSFeeds.com
    By scottatmu in forum Advertising and Related Offers
    Replies: 3
    Last Post: 05-06-2005, 11:34 PM
  3. Forum Skin Business - PreLaunch - ALL CUSTOM WORK
    By NickRac in forum Developed Websites for Sale
    Replies: 3
    Last Post: 03-17-2005, 09:56 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