I got this script...
require_once('Connections/Connection.php');
mysql_select_db($database_Connection, $Connection);
//first opening of directory to extract filenames, keywords, and descriptions
$dh = opendir("C:\webfolder");
while (false !== ($filename = readdir($dh))) {
if ((preg_match('/htm/', $filename)) || (preg_match('/sun(.*)php/', $filename))){
$handle = fopen($filename, "rb");
$tags = get_meta_tags ($filename);
$description = $tags['description'];
$keywords = $tags['keywords'];
echo "$filename : $description : $keywords \n";
$buffer = fread($handle, filesize($filename));
fclose($handle);
//get the title
preg_match('#<title>(.*)</title>#isU', $buffer, $match);
$title = $match[1];
echo "$title \n";
//get the content
preg_match('#<body(.*)</body>#isU', $buffer, $bodymatch);
$bodytemp = $bodymatch[1];
//start of function to strip punctuation and tags out
$search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
"'<[\/\!]*?[^<>]*?>'si", // Strip out html tags
"'([\r\n])[\s]+'", // Strip out white space
"'&(quot|#34);'i", // Replace html entities
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&#(\d+);'e"); // evaluate as php
$replace = array ("",
"",
"\\1",
"\"",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
"chr(\\1)");
$body1 = preg_replace ($search, $replace, $bodytemp);
$body3 = str_replace('/', '', $body1);
//end of function
$body = strip_tags($body3);
$content = stripslashes($body);
$content = preg_replace('/[^\w\s]/', '', $content);
//$content = preg_replace('/[^A-Za-z0-9_]/', ' ', $bodytemp);
echo "$content \n\n"; $sqlquery = "INSERT INTO fullsearch (page_id, page_url, page_title, page_description, page_keywords, page_content)
VALUES('','$filename', '$title', '$description','$keywords', '$content')";
echo "FILENAME: $filename\n<br>QUERY: $sqlquery <br>\n";
$results = mysql_query($sqlquery);
echo "ERROR: " . mysql_error() ."<br><br><br>\n";
}
else{
}
}
It times out in the "r"'s of my files, with a fatal exception error because the
Fatal error: Maximum execution time of 30 seconds exceeded
error message. Can I turn that up in my internal php.ini file, or shorten the processing time? I'm running it locally.