Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:55:29+00:00 2026-06-11T16:55:29+00:00

I’m trying to configure the SimplePie RSS parser to cache feeds into a mySQL

  • 0

I’m trying to configure the SimplePie RSS parser to cache feeds into a mySQL database, but I keep getting this error messages when I try to load a SimplePie page:

  • Fatal error: Call to a member function set_cache_location() on a non-object
  • Warning: substr() expects parameter 1 to be string, array given in
  • Warning: PDO::__construct() expects parameter 2 to be string, array given

When I set “port” as “port” I get the following error message:

Warning: mysql:// “IT DISPLAYS MY DB USERNAME AND PASSWORD HERE” is
not writeable. Make sure you’ve set the correct relative or absolute
path, and that the location is server-writable. in
/home/…../SimplePie.php on line 1357

Is there anyone familar with SimplePie?

EDIT

In the code below I’ve obviously left out my username and password for the mySQL settings. But I just wanted to acknowledge that I “know” I’m supposed to replace those values. Also, I use “3306” as my port number since I’m told that ‘s the default port number for mysql…and “localhost” for the hostname

$feed->set_cache_location(‘mysql://username:password@localhost:3306/database’);

<?php

include('./base.php');
require_once('./php/autoloader.php');

$feed = new SimplePie();
$feed->set_cache_location('mysql://username:password@hostname:3306/database');

$rssurl = $_GET['r'];
$feedlimit = $_GET['limit'];

if (!empty($feedlimit)) {
$feedlimit = $_GET['limit'];
}

else {

$feedlimit = 10;

}

// Set which feed to process.
if (!empty($rssurl)) {

    $feed->set_feed_url($rssurl);

}

else 

    $rss_results = mysql_query("SELECT feed_id, feed_url, feed_title, feed_order, feed_page_id FROM user_feeds  WHERE ((feed_owner = '" . $_SESSION['UserId'] . "') AND (feed_page_id = '" . $pageid . "')) ORDER BY feed_order ASC LIMIT 1;");

        if ($rss_results) {

        while($row = mysql_fetch_array($rss_results))
        {
        $feed->set_feed_url($row[feed_url]);

        }

        }
        else {
          // something went wrong.
          echo mysql_error();
}



$feed->enable_cache(true);

// Run SimplePie.
$feed->init();

// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();

// Let's begin our XHTML webpage code.  The DOCTYPE is supposed to be the very first thing, so we'll keep it on the same line as the closing-PHP tag.
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Feed Page</title>
<script type="text/javascript" src="./js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui-1.7.1.custom.min.js"></script>
<link rel='stylesheet' href='./css/styleb.css' type='text/css' media='all' />

<script type="text/javascript">
  // When the document is ready set up our sortable with it's inherant function(s)
  $(document).ready(function() {
    $("#test-list").sortable({
      handle : '.handle',
      update : function () {
          var order = $('#test-list').sortable('serialize');
        $("#info").load("process-sortable.php?"+order);
      }
    });
});
</script>


</head>
<body>


<div>                       






<div id="rsscontent">   

<ul>

    <?php
    /*
    Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
    */
    foreach ($feed->get_items(0,$feedlimit) as $item):

        $feeditem = $item->get_feed();
    ?>
<?php if($_GET["view"] === "headlines") {

        echo "<li><h2 class='feed_entry_title'><a href='";
        echo $item->get_permalink();
        echo "'>";      
        echo $item->get_title();
        echo "</a></h2>";
        echo "<hr /></li>";

        }

elseif ($_GET["view"] === "excerpts") { 

        echo "<li><h2 class='feed_entry_title'><a href='";
        echo $item->get_permalink();
        echo "'>";
        echo $item->get_title();
        echo "</a></h2><div class='feed_entry_content'>";
        echo $item->get_description();
        echo "</div><hr /></li>";

} else { 

        echo "<li><h2 class='feed_entry_title'><a href='";
        echo $item->get_permalink();
        echo "'>";
        echo $item->get_title();
        echo "</a></h2><div class='feed_entry_content'>";
        echo $item->get_content();
        echo "</div><hr /></li>";


} ?>

    <?php endforeach; ?>
 <ul>
</div>

</body>


</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:55:30+00:00Added an answer on June 11, 2026 at 4:55 pm

    I have gone through the php code and found out that the problem is in MySQL.php.

    As a quick fix, just comment out MySQL.php in the Cache directory (line 90-94):

    public function __construct($location, $name, $type)
    {
        $this->options = array(
              //'user' => null,
              //'pass' => null,
              //'host' => '127.0.0.1',
              //'port' => '3306',
              //'path' => '',
              'extras' => array(
                    'prefix' => '',
              ),
        );
        $this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
    

    Then it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.