Jump to content

Recommended Posts

i am getting an rss feed.. generated by http://www.rssfeedreader.com

 

I got the link set up and put the php code in the layer and turned the page into .php and it works good. just like to disable any links in the layer so users of my site cannot click on the links to get out of my site.

<?php

$rssFeed = file_get_contents($URL);

$rssSplit = split('"<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
if ($i != 0) {
	list($data) = split("</a>", $link); 
	list(,$title) = split('">', $data);

	$link = '<a ' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

print $rssFeed; // display the contents
?>

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1";

$rssFeed = file_get_contents($URL);

$rssSplit = split('"<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
if ($i != 0) {
	list($data) = split("</a>", $link); 
	list(,$title) = split('">', $data);

	$link = '<a ' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

 

As a side note $HTTP_* has been depreciated. See http://us2.php.net/manual/en/reserved.variables.php

 

 

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1";

$rssFeed = file_get_contents($URL);

$rssSplit = split('"<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
//debug($link);
if ($i != 0) {
	list($link) = split("</a>", $link); 
	list(,$title) = split('" >', $link);

	$title = '"' . $title;
	$link = '"<a' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

 

Sorry some minor issues, that should work.

Try this:

 

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1";

ob_start();
include($URL);
$rssFeed = ob_get_contents();
ob_end_clean();

$rssSplit = split('"<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
//debug($link);
if ($i != 0) {
	list($link) = split("</a>", $link); 
	list(,$title) = split('" >', $link);

	$title = '"' . $title;
	$link = '"<a' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

Sorry about that, I was parsing the feed in the earlier one, this one should work

 

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1";

ob_start();
include($URL);
$rssFeed = ob_get_contents();
ob_end_clean();

$rssSplit = split('<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
//debug($link);
if ($i != 0) {
	list($link) = split("</a>", $link); 
	list(,$title) = split('" >', $link);

	$link = '<a' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

Thanks alot works a treat www.technicalchat.co.uk  anychance i could take out the bottom 'Clickbank Data Feeds'

 

The only reason i am using it is because i dont have the knowledge to try putting a rss reader on my site for my self so i am using this. It will have to do though.

 

Also. Is it as easy as changing the link to the rss feed for another one and it will do the same with the links?

I would think so...

 

Thanks alot. :)

 

 

It would as long as they are in the same format.

 

The feed I did it for I had to split a link using  " >  with the space in between, it could be just > but the issues arises that if a title has > in it, it will not work right.

 

I get 403 forbidden trying to view that page, if I could see I am sure removing that clickbank isn't too hard.

Just those 3 words? Pretty easy to do:

 

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1";

ob_start();
include($URL);
$rssFeed = ob_get_contents();
ob_end_clean();

$rssSplit = split('<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
//debug($link);
if ($i != 0) {
	list($link) = split("</a>", $link); 
	list(,$title) = split('" >', $link);

	$link = '<a' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

$rssSplit = array();
	$rssSplit = split('<span style="width:100%;border:1px;border-color:#000000">', $rssFeed);
	$i=0;
	foreach ($rssSplit as $line) {
		if ($i != 0) {
			list($text) = split('</span>', $line);
			$replace = '<span style="width:100%;border:1px;border-color:#000000">' . $text . '</span>';
			$rssFeed = str_replace($replace, "", $rssFeed);
		}else {
			$i++;
		}
	}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

  • 3 weeks later...
  • 3 weeks later...

Hi this is great. but when changing the url to another feed for another page.. Such as the yahoo feed i get the yahoo logo on the middle of my page.

 

How can this be removed?

 

<?php
$olderror_reporting =error_reporting(0);
$URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.news.yahoo.com%2Frss%2Ftech&newpage=1&chead=&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=781&max=10&tlen=0&rnd=&bt=1&bs=None&nmb=1&ntb=1&naf=1&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%23FFD7A6&bg=%233062ba&bc=%233062ba&spc=&ims=1&tc=%23FFD7A6&ts=16&tfont=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1";

ob_start();
include($URL);
$rssFeed = ob_get_contents();
ob_end_clean();

$rssSplit = split('<a', $rssFeed);
$i=0;
foreach ($rssSplit as $link) {
//debug($link);
if ($i != 0) {
	list($link) = split("</a>", $link); 
	list(,$title) = split('" >', $link);

	$link = '<a' . $link . '</a>';
	$rssFeed = str_replace($link, $title, $rssFeed);	
}	
$i++;
}

$rssSplit = array();
	$rssSplit = split('<span style="width:100%;border:1px;border-color:#000000">', $rssFeed);
	$i=0;
	foreach ($rssSplit as $line) {
		if ($i != 0) {
			list($text) = split('</span>', $line);
			$replace = '<span style="width:100%;border:1px;border-color:#000000">' . $text . '</span>';
			$rssFeed = str_replace($replace, "", $rssFeed);
		}else {
			$i++;
		}
	}

print $rssFeed; // display the contents

error_reporting($olderror_reporting);
?>

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.