2

I am using Laravel 5.2. I need to get RSS feeds using SimplePie, so I install the library through composer.json and now my vendor folder contains simplepie but when i run the following code this error shows:

ErrorException in SimplePie.php line 1379: ./cache is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.

My code in route:

Route::get('feed', function () {

$feed = new SimplePie();

$feed->set_feed_url(array(
    'http://www.thenews.com.pk/rss/2/16' //it has no images
));
$feed->init();
$itemCount=$feed->get_item_quantity();
return $itemCount;
});
Fabio Antunes
  • 22,251
  • 15
  • 81
  • 96
Bilal Hussain
  • 149
  • 1
  • 12

2 Answers2

2

Create a writeable cache folder for simplepie in the /storage/ folder (I called mine simplepie_cache).

Set the path in your feed object:

$feed->set_cache_location(storage_path() . '/simplepie_cache');

That should do the trick.

0

check what is saying ./cache is not writeable can't write to cache folder check permissions to this folder or try a L5 wrapper for SimplePie https://github.com/willvincent/feeds

SergkeiM
  • 3,934
  • 6
  • 36
  • 69