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 6173819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:38:28+00:00 2026-05-23T23:38:28+00:00

Im loading the php rss parsing library simplepie onto my site and i include

  • 0

Im loading the php rss parsing library simplepie onto my site and i include it in the header.php file like so:

<?php
    // Make sure that SimplePie is loaded
require_once('inc/simplepie.inc');
$feed = new SimplePie('rss.com'); <-- This is a example url

// Make sure the content is being served out to the browser properly.
$feed->handle_content_type();

?>

Then i try to access the object from another page called page.php and it gives me this error:

Fatal error: Call to a member function get_items() on a non-object in /home/callofdu/public_html/wp-content/themes/Starkers/page.php on line 13

I get the error from this line of code:

<?php
foreach ($feed->get_items() as $item)
{}
?>

Its weird because if i include both of those chuncks of code together on the same php page it all works fine.

I just am not understanding something, please help.

  • 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-05-23T23:38:28+00:00Added an answer on May 23, 2026 at 11:38 pm

    Several things could be wrong here:

    1. Code order is incorrect.
      Realise that when you require or include a PHP file, the entire code of that file will be executed at that point. In other words: interpret the command require_once as “Insert file contents here”, and check whether the order of lines of code are still right.

    2. You are calling page.php in a separate request.
      If you use your browser to manually surf to page.php after the completeion of the previous page, $feed will no longer exist. If you do want it to live on between requests, do the following:

      a. Replace all instances of $feed with $_SESSION['feed']
      b. In the first line of every file that you surf to (so not the require’d files), put session_start();

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

Sidebar

Related Questions

I am experimenting with loading CSV in PHP. I have a CSV file, with
How do I show loading text in PHP while code (like a massive database
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
I'm loading an image from a file, and I want to know how to
I currently have a form set up that passes some data to a php
When loading a page for the first time (!IsPostback), I am creating a button
When loading XML into an XmlDocument, i.e. XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); is
Some loading routines in my program takes to long to complete. I want a
What is Lazy Loading? [Edit after reading a few answers] Why do people use
I'm dynamically loading user controls adding them to the Controls collection of the web

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.