Support » Plugins » fetch_rss url problem

  • Hi
    I´m using fetch_rss function to display some headlines of other blogs at the bottom of my blog.
    I´m using the function as explained on the wiki:
    <?php
    require_once(ABSPATH . WPINC . ‘/rss-functions.php’);
    $rss = fetch_rss(‘http://example.com/rss/feed/goes/here&#8217;);
    echo ‘

    ‘;
    ?>

    and everything seems OK

    But when I click on a headline, and I´m supossed to go to the articles post, URL appears wrong. I get something like this:
    http://labs.valechumbar.com/\%22http://feeds.feedburner.com/~r/Muyriver/~3/41656566/\%22

    The first http:// is my blog (where the fetch_rss actually is), and the second one the rss blog where I´m supossed to be linked to.
    When I click there I just return to my own blog, not going to the destination one

    Any ideas on how to fix this?

    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Something is wrong with your code. You need to post *exactly* what your code looks like, instead of posting the wiki example again.

    Also, when you post code, put it between backticks (that’s the character below the tilde ~ ) so that we can actually see it.

    Thread Starter Hitokiri

    (@hitokiri)

    :s I didn´t realize i posted the code wrond
    There it goes again:

    <?php
    require_once(ABSPATH . WPINC . '/rss-functions.php');
    $rss = fetch_rss('http://feeds.feedburner.com/Muyriver');
    echo '<ul>';
    for($i=0;$i<5;$i++) {
    $item=$rss->items[$i];
    echo '<li><a href=\"' . $item['link'] . '\" title=\"' . $item['title'] . '\">' . $item['title'] . '</a></li>';
    }
    echo '</ul>';
    ?>

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Ah. Okay. I was not aware that the wiki had screwed up the backslashes. All those backslashes in the echo line… You don’t need ’em.

    Try this code:

    <?php
    require_once(ABSPATH . WPINC . '/rss-functions.php');
    $rss = fetch_rss('http://feeds.feedburner.com/Muyriver');
    echo '<ul>';
    for($i=0;$i<5;$i++) {
    $item=$rss->items[$i];
    echo '<li><a href="' . $item['link'] . '" title="' . $item['title'] . '">' . $item['title'] . '</a></li>';
    }
    echo '</ul>';
    ?>

    Thread Starter Hitokiri

    (@hitokiri)

    Great!

    Now it workd perfectly. We should correct the wiki

    Thank you very much Otto

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, I modified the Wiki. Appearantly, the wiki always adds backslashes to double quote marks like that. Annoying.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘fetch_rss url problem’ is closed to new replies.