mkob mkob - 19 days ago 6
PHP Question

How do I fix simplepie? failed to open stream: No such file or directory

I am trying to pull in some posts from a remote wordpress site with simplepie. I have installed the library and put what I think is the right code at the top of the .php page.

Right now my it looks like:

<?php
require_once('../autoloader.php');

$feed = new SimplePie();

$feed->set_feed_url('http://simplepie.org/blog/feed/');

$feed->enable_cache(true);
$feed->set_cache_location('cache');
$feed->set_cache_duration(1800);

$feed->init();

$feed->handle_content_type();

?> {doc type}


But when I load my page it tells me:


Warning: require_once(../autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/27/9279927/html/LatestHOPE.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '../autoloader.php' (include_path='.:/usr/local/php5_3/lib/php') in /home/content/27/9279927/html/LatestHOPE.php on line 2


What's up with that? Why is it telling me this?
I have autoloader.php in my root directory.

Answer

You have it in your root directory!? That is a strange location. However, if that is true, use

require_once('/autoloader.php');

Perhaps you mean in your home directory? For that use

require_once('/home/<your username>/autoloader.php');