RE: How to download an entire dynamic website?
| From: | Tim Ward | Date: | Tue, 21 Aug 2001 09:11:05 +0000 |
| Subject: | RE: How to download an entire dynamic website? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-63655@lists.php.net to get a copy of this message | ||
Do you mean make an html copy?
If so this is a simplified copy of what I use as the start of building a
search engine database for my web site, I think it'll only work on the local
database and in this case needs to be in the document root directory to
work...
Tim
function GetPage($file, $root, $db)
{ $flines = file("http://localhost/$root$file");
$filetext = "";
$inscript = false;
foreach ($flines as $line) $filetext = $filetext . " " .
trim($line);
// now do what you want with the html, save it to db or as file in
html version of site
...
...
} // end of fn GetPage
function spider($root, $db)
{ $dhandle = opendir($root);
while ($ddFile = readdir($dhandle))
{ if ($ddFile != "." && $ddFile != "..")
{ if (is_dir("$root/$ddFile"))
{ spider("$root$ddFile/", $db);
} else
{ if (substr($ddFile, -5) === ".html" ||
substr($ddFile, -4) === ".php") GetPage($ddFile, $root, $db);
}
}
}
closedir($dhandle);
} // end of fn spider
function SearchBuild($thissite = "")
{ $db = new DbConnect();
spider("$thissite", $thissite, $db);
$db->Close();
} // end of fn SearchBuild
----------
From: Josh [SMTP:jawa@networld.com]
Sent: 20 August 2001 18:27
To: php-general@lists.php.net
Subject: How to download an entire dynamic website?
Does anyone know some good programs (or other ways) to download an
entire
dynamic website?
Thanks