Using an RSS Feed (This is Easy)

Discussion in 'XML & RSS' started by yfs1, Jan 5, 2005.

  1. finaldestination

    finaldestination Guest

    Messages:
    212
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #221
    how to make take feed from two sources?


    i get this error

    what i did was changd the url of feed location and copy pasted the full code twice...
     
    finaldestination, Jun 19, 2006 IP
  2. Emory

    Emory Peon

    Messages:
    82
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #222
    The random script is not working for me--no error message or anything.

    I use LastRSS and it works ok, no random though :(
     
    Emory, Jun 25, 2006 IP
  3. Jez

    Jez Well-Known Member

    Messages:
    532
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    138
    #223
    I am still using yfs1's cool script - have been for about a year now I expect. Excellent.

    I have one question. Is it possible, or would it be possible to have the script work a little like adsense does and produce on topic feeds for the page or pages in question? That would be pretty cool.
     
    Jez, Jun 26, 2006 IP
  4. greenworld

    greenworld Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #224
    thank you for sharing.

    what the rotating feed means?
    does it rotate feed?

    I could only add one feed though.

    today I did try it again after previous attempt, and got it to work,
    I assume this script can only be used with one feed, I tried it with 2 feeds, did not work.

    anyone using it with more than one feed?


    thanks
     
    greenworld, Jun 27, 2006 IP
  5. nervo

    nervo Active Member

    Messages:
    1,012
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    90
    #225
    That's the same problem I have... I can't make that rotating feed script to work... ;(
     
    nervo, Jun 30, 2006 IP
  6. WebFreedom

    WebFreedom Peon

    Messages:
    807
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #226
    Hi Jez,

    I'm not sure if this is what you're looking for, but Allfeeds.com (http://publisher.allfeeds.com) has an XML Feeds program that can serve on-topic advertiser feeds to your web pages. It's not exactly the same as an rss news feed, but I thought it may be something of interest to you. I've had good results with their programs as an affiliate publisher.

    HTH,
    Sam
     
    WebFreedom, Jul 12, 2006 IP
  7. rezx

    rezx Peon

    Messages:
    312
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #227
    Recently my yahoo rss feeds could not fetch the pictures and when i click on it it goes to a 404 page. :S
     
    rezx, Jul 14, 2006 IP
  8. michaelwalker

    michaelwalker Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #228
    Dear readers,

    I am trying to use the "straight" version of this script. It works fine with a single RSS feed however when i try to add multiple feeds i get this error:

    You can view my site @ http://server11.web-mania.com/users/crkdeign/rss.php
    Thanks in advance.
    Michael
     
    michaelwalker, Jul 24, 2006 IP
  9. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #229
    You can only use one feed with the Straight code...You need to go with the rotating if you want multiple.
     
    yfs1, Jul 24, 2006 IP
  10. michaelwalker

    michaelwalker Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #230
    Will the rotating code allow me to display two different feeds at the same time? In different parts of the page?
     
    michaelwalker, Jul 24, 2006 IP
  11. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #231
    No, both sets of code were originally for only providing one feed
     
    yfs1, Jul 24, 2006 IP
  12. michaelwalker

    michaelwalker Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #232
    hmm do you know of any scripts that will allow me to provide two feeds? Or could i include the feeds separetly using php include function?
     
    michaelwalker, Jul 24, 2006 IP
  13. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #233
    Yes, CaRP is probably the best one out there. I created the code in this thread nearly 2 years ago when there were very few options (or the options that were out there had complex explanations)

    I am using CaRP here:
    http://www.hapahapa.com/latest-news.htm

    It is extremly adaptable and can be very easily changed as far as layout.

    If you want to try it and post any questions here. To be honest I'm more comfortable helping people with that code then the ones in this thread as its been years at this point
     
    yfs1, Jul 25, 2006 IP
  14. kelp

    kelp Peon

    Messages:
    306
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #234
    I'm having trouble finding the config options to do the following in CaRP:
    Remove the <br />'s after every line
    Remove where the feed is from and the description of the feed
    Making the link target in _blank and adding rel="nofollow" to the link

    Here's what I have so far:
    CarpConf('maxitems',10);
    CarpConf('iorder','link');
    CarpConf('bi',' <li>');
    CarpConf('ai','</li>');
    CarpConf('poweredby','');

    Basically I just need it to show up like this:
    <li><a href="" target="_blank" rel="nofollow">Hi</a></li>
     
    kelp, Jul 29, 2006 IP
  15. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #235
    Hello, I'm a bit late on this thread, hope some of you are still around.

    I am having trouble getting ssi include command to work on my main page. It works on my other pages just fine any suggestions?

    Also, anyone know how to make magpie include rss images? I have the news feeds working just fine. Thanks Jen-
     
    Jen-, Jul 31, 2006 IP
  16. pcdoc

    pcdoc Active Member

    Messages:
    690
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    70
    #236
    I am having trouble getting ssi include command to work on my main page.

    a URL would help ;-)
     
    pcdoc, Aug 1, 2006 IP
  17. ajscottsr

    ajscottsr Peon

    Messages:
    388
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #237
    I made modifications to the ORIGINAL script posted at the beginning of this page to use echo instead of printf and to use cURL instead of fopen for those hosts that don't allow fopen to remote servers such as dreamhost.

    I inserted the google news feed URL and it works great:

    http://www.outblogger.com/demo/dp_rss.php

    Here ya go:

    <?php
    $insideitem = false;
    $tag = "";
    $title = "";
    $description = "";
    $link = "";
    $locations = array('http://news.google.com/?ned=us&topic=s&output=rss', 'http://news.google.com/?ned=us&topic=s&output=rss', 'http://news.google.com/?ned=us&topic=s&output=rss');
    srand((float) microtime() * 10000000); // seed the random gen 
    $random_key = array_rand($locations);
    function startElement($parser, $name, $attrs) {
     global $insideitem, $tag, $title, $description, $link;
     if ($insideitem) {
      $tag = $name;
     } elseif ($name == "ITEM") {
      $insideitem = true;
     }
    }
    function endElement($parser, $name) {
     global $insideitem, $tag, $title, $description, $link;
     if ($name == "ITEM") {
      echo "<dt><b><a href='" . trim($link) . "' target='new'>" . trim($title) . "</a></b></dt>\n";
      echo "<dt>" . trim($description) . "</dt><br><br>\n";
      //printf("<dt><b><a href='%s' target=new>%s</a></b></dt>",trim($link),htmlspecialchars(trim($title)));
      //printf("<dt>%s</dt><br><br>",htmlspecialchars(trim($description)));
      $title = "";
      $description = "";
      $link = "";
      $insideitem = false;
     }
    }
    function characterData($parser, $data) {
     global $insideitem, $tag, $title, $description, $link;
     if ($insideitem) {
     switch ($tag) {
      case "TITLE":
      $title .= $data;
      break;
      case "DESCRIPTION":
      $description .= $data;
      break;
      case "LINK":
      $link .= $data;
      break;
     }
     }
    }
    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $locations[$random_key]);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    
    //$fp = fopen($locations[$random_key], 'r') or die("Error reading RSS data.");
    // while ($data = fread($fp, 4096))
     xml_parse($xml_parser, $data) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
    //fclose($fp);
    xml_parser_free($xml_parser);
    ?>
    Code (markup):
    Hope you find this useful, thanks!
     
    ajscottsr, Aug 20, 2006 IP
    Dastar likes this.
  18. bizzy

    bizzy Well-Known Member

    Messages:
    112
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #238
    Thanks to yfs1 and ajscottsr for posting and modifying this script. It is working well!
     
    bizzy, Sep 18, 2006 IP
  19. Oppenheimer Group

    Oppenheimer Group Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #239
    Great code thanks!
     
    Oppenheimer Group, Sep 25, 2006 IP
  20. bentong

    bentong Banned

    Messages:
    3,543
    Likes Received:
    257
    Best Answers:
    0
    Trophy Points:
    0
    #240
    CarpConf('biurl','<a target="_blank" rel="nofollow" href="');
    CarpConf('aiurl','">');
    CarpConf('ailink','</a>');

    dont know about the others.
     
    bentong, Sep 25, 2006 IP