| 
		
			
			
				
			
			
				 
			
			
				
			
		 | 
		
			
			
				 
			
				
			
		 | 
	||||
| 
				Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.  You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us.  | 
		
		 
		![]()  | 
	
		
			
  | 	
	
	
		
		|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
| 
		 | 
	Thread Tools | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
			
			 
				
				Need help with simple RSS praser
			 
			If anyone could help me that would be great 
		
	
		
		
		
		
			
		
		
		
		
	
	My tube sites have rss feeds and I want to list latest videos on other sites, I need something simple and hopefully with cache, I found simpleRSS script but I couldn't get it to work probebly because I'm a noob at those things If anyone could help me that would be great, I can pay a few bucks if needed, icq is in my sig.  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Post your RSS URL here and I'll look at it. 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
			
			 That's very easy. My code below (juts a few lines of PHP) will do the trick. 
		
	
		
		
		
		
			Code: 
	<?php
$feed = file_get_contents ( "http://nubilestube.com/rss.php?location=most_recent" );
$xml_parser = xml_parser_create ();
xml_parse_into_struct ( $xml_parser, $feed, $vals, $index );
$cnt = count ( $index ["TITLE"] );
for($i = 1; $i < $cnt; $i ++) {
	echo "<h3>" . html_entity_decode ( $vals [$index ["TITLE"] [$i]] ["value"], ENT_QUOTES ) . "</h3>\n";
	echo "<p>" . html_entity_decode ( $vals [$index ["DESCRIPTION"] [$i]] ["value"], ENT_QUOTES ) . "</p>\n";
}
xml_parser_free ( $xml_parser );
?>
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 thank you 
		
	
		
		
		
		
			
		
		
		
		
	
	it works, although a bit slow because there's no caching how do I limit number of items parsed?  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
			
			 Here is the same code but with hourly cashing: 
		
	
		
		
		
		
			Code: 
	<?php
$feed = file_get_contents ( "http://nubilestube.com/rss.php?location=most_recent" );
$filename = "cache.txt";
if (file_exists ( $filename ) && (time () - filectime ( $filename )) < 60 * 60) {
	$content = file_get_contents ( $filename );
} else {
	$xml_parser = xml_parser_create ();
	xml_parse_into_struct ( $xml_parser, $feed, $vals, $index );
	$cnt = count ( $index ["TITLE"] );
	$content = "";
	for($i = 1; $i < $cnt; $i ++) {
		$content .= "<h3>" . html_entity_decode ( $vals [$index ["TITLE"] [$i]] ["value"], ENT_QUOTES ) . "</h3>\n";
		$content .= "<p>" . html_entity_decode ( $vals [$index ["DESCRIPTION"] [$i]] ["value"], ENT_QUOTES ) . "</p>\n";
	}
	file_put_contents($filename, $content, LOCK_EX);
	xml_parser_free ( $xml_parser );
}
echo $content;
?>
Can't be easier, right? 
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#8 | |
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 Easily, simple replace this line: $cnt = count ( $index ["TITLE"] ); to this one: $cnt = min ( 5, count ( $index ["TITLE"] ) ); where 5 is your limit. 
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#9 | ||
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 Quote: 
	
  | 
||
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 What's wrong with it? Did you create the "cache.txt" file and chmoded it properly? 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Yes I created the cache.txt file in the same folder and chmoded it to 666 (also tried 777) 
		
	
		
		
		
		
			
		
		
		
		
		
			
		
		
	
	Just outputs a blank page.  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
			
			 Ah, now i see the problem. It's because the cache file is initially blank and it will update only after a hour  
		
	
		
		
		
		
			Here is a slightly fixed code: Code: 
	<?php
$feed = file_get_contents ( "http://nubilestube.com/rss.php?location=most_recent" );
$filename = "cache.txt";
if (file_exists ( $filename ) && filesize ( $filename ) && (time () - filectime ( $filename )) < 60 * 60) {
	$content = file_get_contents ( $filename );
} else {
	$xml_parser = xml_parser_create ();
	xml_parse_into_struct ( $xml_parser, $feed, $vals, $index );
	$cnt = min ( 5, count ( $index ["TITLE"] ) );
	$content = "";
	for($i = 1; $i < $cnt; $i ++) {
		$content .= "<h3>" . html_entity_decode ( $vals [$index ["TITLE"] [$i]] ["value"], ENT_QUOTES ) . "</h3>\n";
		$content .= "<p>" . html_entity_decode ( $vals [$index ["DESCRIPTION"] [$i]] ["value"], ENT_QUOTES ) . "</p>\n";
	}
	file_put_contents ( $filename, $content, LOCK_EX );
	xml_parser_free ( $xml_parser );
}
echo $content;
?>
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Perfect! Thanks I appreciate it  
		
	
		
		
		
		
			
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 You're welcome  
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Affiliate 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2002 
				Location: Icq: 94-399-723 
				
				
					Posts: 24,433
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 how do I add substr to the DESCRIPTION value? 
		
	
		
		
		
		
			
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#16 | 
| 
			
			
			
			 So fuckin' bored 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jun 2003 
				
				
				
					Posts: 32,386
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Excuse me? What do you mean on "substr"? 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Obey the Cowgod  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 |