Jump to content

Filterout duplicate content from a RSS feed


forzatio

Recommended Posts

foreach ($rss->items as $item)  {



$description =  $item[description];
$url =		$item[link];
$title =	$item[title];


$array = array($title);
$array_unique = array_unique($array);

foreach ($array_unique as $value) {
    echo "$value<br><br>";	
}




}



 

I tried it like this, but I still get duplicate titles.

Link to comment
Share on other sites

foreach ($rss->items as $item)  {



$description =  $item[description];
$url =		$item[link];
$title =	$item[title];


$array = array($description);
$array_unique = array_unique($array);

foreach ($array_unique as $value) {
    echo "$value<br><br>";	
}
}

 

I tried it with the description there are also some duplicates left in there,  can I do this code above ? it's a foreach in a foreach.. I'm not sure about my code.

Link to comment
Share on other sites

Ok another try, with this code I want to get $description, $title and $url into arrays, and then use array_unique (in this example for the $title) with this code it's not giving any output though.

 

 

 

<?php require_once 'rss_fetch.inc';

$url = 'http://www.example.com/feed.rss';
$rss = fetch_rss($url);



foreach ($rss->items as $item)  {



$description =  array ($item[description]);
$url =		array ($item[link]);
$title =	array ($item[title]);



$array_unique = array_unique($title);

foreach ($array_unique as $value) {
    echo "$value<br><br>";	
}


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.