UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
Su M Tu W Th F Sa
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Sponsored Links
Latest Postings
The History Thread...
by Cyrez
08/11/15 12:11 AM
Latest Reviews
Topic Options
Rate This Topic
#19256 - 01/21/03 04:06 AM help a newbie please
xero Offline

Registered: 03/28/02
Posts: 192
ok hi, im working on my site, and im trying to add xml news feeds. it works fine when i only have one, but when i wanna get feeds from multiple sources on one page, it gives me error:

 Fatal error: Cannot redeclare untag() (previously declared  
and the php code im using to add the xml news feeds is:

$feed = ',5000,73,00.xml';

ini_set('allow_url_fopen', true);
$fp = fopen($feed, 'r');
$xml = '';
while (!feof($fp)) {
	$xml .= fread($fp, 128);
function untag($string, $tag) {
	$tmpval = array();
	$preg = "|<$tag>(.*?)</$tag>|s";

	preg_match_all($preg, $string, $tags);
	foreach ($tags[1] as $tmpcont){
		$tmpval[] = $tmpcont;
	return $tmpval;
$items = untag($xml, 'item');

$html = '

foreach ($items as $item) {
	$title = untag($item, 'title');
	$link = untag($item, 'link');

	$html .= '<a href="' . $link[0] . '">' . $title[0] . "</a>
$html .= '';

echo $html;
i have other feeds as well, so i just simply copy and pasted that same code, pasted again and changed the url of the xml. obviously this isnt the way i should be doing it. can anyone help? im really new at this php stuff :p
"Most of our imports come from outside the country" -George W. Bush

Sponsored Links
#19257 - 01/21/03 06:48 AM Re: help a newbie please
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
The error means that you have 2 functions called 'untag'. I see only 1 untag function in your code however. So are you loading in any code from other files that has an untag function in it? Cause that would hurt ya.
Domain Registration, Hosting, Management

#19258 - 01/21/03 08:45 AM Re: help a newbie please
jonconley Offline
UGN Super Poster

Registered: 10/08/02
Posts: 955
Loc: Merrill, IA, USA
Did you get my PM?

I think he is running all that code separately for each URL. He could add a loop that will go through each URL or simply remove the calls to function where it occurs later on I believe.

#19259 - 01/21/03 09:35 AM Re: help a newbie please
Deviation187 Offline

Registered: 03/26/02
Posts: 536
Loc: L.A Cal.
lol id give him another couple of hours.. hes still sleeping
"Hmm, they have the internet on computers now." - Homer Simpson

#19260 - 01/21/03 12:55 PM Re: help a newbie please
xero Offline

Registered: 03/28/02
Posts: 192
Yeah, i got the pm, and i agree its not liking the fact that i just copy and pasted the same code lol.. But how would i would i use one piece of code? like say i wanted to get the feed from and another one from how would i have to chnage the php to do so? oh and silentrage, yer right, im just copying that same code and pasting it again, changing the url and it is hurting me heh.. how will i use a loop to use only one code for multiple feeds?
"Most of our imports come from outside the country" -George W. Bush


Moderator:  §intå×, Gremelin 
Featured Member
Registered: 02/28/02
Posts: 7193
Forum Stats
2154 Members
46 Forums
40673 Topics
75846 Posts

Max Online: 1567 @ 04/25/10 02:20 AM
Top Posters
UGN Security 33835
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
Suri John, boa, claralobo, cdefgh368568, HushHush
2153 Registered Users
Who's Online
0 registered (), 277 Guests and 193 Spiders online.
Key: Admin, Global Mod, Mod
Latest News

  Get Firefox!
Get FireFox!