items as $item) { // If the source matches the exclude list, ignore if (in_array($item->origin->title, $exclude)) continue; // If it has a Newsletters label, ignore if (in_array('user/-/label/Newsletters', $item->categories)) continue; $u = $item->alternate[0]->href; $out[] = array( 'id' => $item->id, 'title' => $item->title, 'source' => $item->origin->title, 'link' => empty($u) ? $base . 'i/' : $u ); } // And we save the results as json file_put_contents('public/rss.json', json_encode($out));