#!/usr/bin/perl

#use Net::SCP::Expect;
# perl -MCPAN -e 'install "Net::SCP::Expect"'
require "functions.pl";


CACHE();
sub CACHE(){

	my $timeout	= "300";
	my $ua		= "Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:1.6) Gecko/20040206 Firefox/1.0.1";

	my %CACHING = (
		"/server/wwwroot/index.html" => "http://www.zoozle.org/index.php",		# .net: "/srv/server/wwwroot/index.html" => "http://www.zoozle.net/index.php",
	#	"/server/en.wwwroot/index.html" => "http://en.zoozle.net/index.php",
	#	"/srv/server/de.wwwroot/index.html" => "http://de.zoozle.net/index.php",

	#	"/server/apache2/htdocs/de/index.html" => "http://85.214.90.176/de/index_de.php",
	#	"/server/apache2/htdocs/org/index.html" => "http://85.214.90.176/org/index_org.php",
	#	"/server/apache2/htdocs/devu/index.html" => "http://85.214.90.176/devu/index_devu.php"
	);

	while( my ( $path, $url ) = each(%CACHING) ){
		my $page = &http_get($url, $timeout, $ua, );
		print "Generate Cache for $url\n";
		
		if ( length($page) >= 1000 ) {
		
			unlink $path;
			open(WH,">$path");
				print WH $page;
			close WH;

		}; # if ( length($page) >= 1000 ) {

	}; # while( my ( $path, $url ) = each(%CACHING) ){

	return 1;

}; # sub CACHE(){}