• I have a wordpress installation linked to from my site (actually on the same server) and I’m trying to display the most recent blog posts in the sidebar of each site page.

    Not knowing any better, I downloaded RSS_PHP v3.01 parser and uploaded the unzipped files to the server. I’m working on the theory that I need to process the wordpress posts feed and display it.

    The PHP code I inserted in the WordPress index.php for the theme I’m using is not working, and outputs error about not being able to connect.

    include_once '../rss_php.3.01/rss_php.php';
        $rss = new rss_php;
    
        $rss->load('https://domain-name/test/?feed=rss2');
    
        $items = $rss->getItems();

    I’m guessing the error is in the rss load url, but I’ve tried several url formats (obviously changing the domain.tld to my own domain) to access the feed:

    https://domain.tld/feed/rss2/
    Cannot connect

    https://domain.tld/wp-rss2.php
    This complains that the file is not XML

    https://domain.tld/?feed=rss2
    Cannot connect

    Do I need to enable something in the wp installation to ‘activate’ feeds before I can access them?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi there, I’m certainly no expert at rss feeds,
    but the above url doesn’t seem right.
    I just checked my own.

    https://www.myweb.com/wordpress/?feed=rss2
    https://www.myweb.com/wordpress/?feed=comments-rss2
    Theres no link for your site, but is your blog in its own directory.
    hope it works out for you. mike.

    Thread Starter konigrot

    (@konigrot)

    Sorry for not being clear enough. The full path access url I used for that particular method does include the install directory:

    https://www.click-profits.com/test/?feed=rss2

    In browser it outputs xml properly, but the index.php keeps getting an access error:
    http_handler could not connect to click-profits.com:80 (PHP Error Number: 111, Message: Connection refused

    https://www.click-profits.com/test/wp-rss2.php
    This complains that the file is not XML

    What’s the simplest code to display recent posts in PHP?

    Are you using wordpress 2.5.1
    Sorry not really helping you much.
    not sure really why you need RSS_PHP v3.01
    woordpress will parse the feed fine.
    if you’re using sidebars you can always test this by adding your feed address to the sidebar rss widget.
    As far as i am aware there is no feed folder,
    everything is held in the database ready for wp-rss2.php to handle
    Don’t worry, this forum is excellent with a lot of experts on the subject I’m sure it will be resolved quickly for you.
    good luck. mike

    Thread Starter konigrot

    (@konigrot)

    Yes – using latest wordpress. You say wordpress will parse the feed fine – given that the ‘latest posts’ info is for a webpage and not to be displayed within wordpress I thought I needed to parse the feeds from wordpress to use them elsewhere.

    Am I wrong?

    Thread Starter konigrot

    (@konigrot)

    Am now trying a different parser, with the following code in the page:

    <?php
    require_once “../RSS.php”;
    $r = & new XML_RSS('https://click-profits.com/test/?feed=rss2');
    if(!file_exists($r)){
    echo “failed to create XML_RSS”;
    }
    $r->parse();
    echo “<h3> Recent Blog Entries From WordPress </h3>”;
    echo “<ul>\n”;
    foreach ($r->getItems() as $entry)
    {
    echo “<li><a href=\”".$entry['link'].”\”>”.$entry['title'].”</a></li>\n”;
    }
    echo “</ul>\n”;
    ?>

    Get the ‘Recent Blog entries…’ entry but otherwise nothing – and there ARE Blog posts before asking!

    I cerainly hope it works out for you, after all this work.
    good luck. mike

    Thread Starter konigrot

    (@konigrot)

    At the mo it’s almost certainly something stupidly simple I’m overlooking in my lack of experience with PHP functionality, or feeds.

    Unless I get a thunderbolt formt he blue it’s going to be a slow trial an error self-tutorial in PHP from the start. Hello world, here we come.

    If the problem is happening for multiple scripts (including WP’s built-in RSS widgets), and “Connection Refused” is always the problem, then this seems to be an issue with your server’s firewall. Though, it could be with your server’s PHP settings.

    Your best bet is to check your webhost’s support area for more info or contact their support.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Noob cannot parse WordPress feed’ is closed to new replies.