'; //$ln_keyword = "0 interest"; if($ln_keyword != 'index') { $key = $ln_keyword; $dhtitle = $key.' - '.$dtitle; } else { $dhtitle = $dtitle; $key = $sitekeyword; } $filename = eregi_replace( ' ', '_', $key).".gz"; $dir = "pages/"; //open or generate web page gziped source file for reading //$gzfile = gzopen($dir.$filename, "r"); if($lines = @gzfile($dir.$filename)) // file exist { $gz_contents = ""; foreach ($lines as $line) { $gz_contents .= $line; } $sections = explode("<<<<<<<<<<<<<<<<<<--------------------->>>>>>>>>>>>>>>>>", $gz_contents); $art_links = $sections[0]; $dir_links = $sections[1]; $art_links = ereg_replace('target="_blank"', '', $sections[0]); if(ereg('>>>>>>>>>>>>>>>>'.$site_links; //Directory Links $links_select = mysql_query( "SELECT * FROM keywords WHERE domain_id = '$did' ORDER BY RAND(NOW()) LIMIT 42") or die(mysql_error()); $dir_links = ''; while($links_row = mysql_fetch_array($links_select, MYSQL_ASSOC)) { $ln_name = ereg_replace(' ', '-', $links_row["keyword"]).'.htm'; //$ln_name = ereg_replace('&', 'and', $ln_keyword).'.htm'; $dir_links .= '
'.$links_row["keyword"].'
'; } $gz_contents = $gz_contents.'<<<<<<<<<<<<<<<<<<--------------------->>>>>>>>>>>>>>>>>'.$dir_links; // open file for writing with maximum compression $gzfile = gzopen($dir.$filename, "w9"); // write string to file gzwrite($gzfile, $gz_contents); // close file gzclose($gzfile); //echo $gz_filename; //die(); } } else // file not exist { //Article Links $art_links = article($key); //Website Links $site_links = links($key); $gz_contents = $art_links.'<<<<<<<<<<<<<<<<<<--------------------->>>>>>>>>>>>>>>>>'.$site_links; //Directory Links $links_select = mysql_query( "SELECT * FROM keywords WHERE domain_id = '$did' ORDER BY RAND(NOW()) LIMIT 42") or die(mysql_error()); $dir_links = ''; while($links_row = mysql_fetch_array($links_select, MYSQL_ASSOC)) { $ln_name = ereg_replace(' ', '-', $links_row["keyword"]).'.htm'; //$ln_name = ereg_replace('&', 'and', $ln_keyword).'.htm'; $dir_links .= '
'.$links_row["keyword"].'
'; } $gz_contents = $gz_contents.'<<<<<<<<<<<<<<<<<<--------------------->>>>>>>>>>>>>>>>>'.$dir_links; // open file for writing with maximum compression $gzfile = gzopen($dir.$filename, "w9"); // write string to file gzwrite($gzfile, $gz_contents); // close file gzclose($gzfile); } $page_html = ' '.ucwords($key).' '.$dtitle.'

'.$dtitle.'
'.$sitekeyword.'

 

   
'.$dir_links.'
 
 
 
Investing NW Painc Investing Articles catalogue

2005  2003  2004  2001
'; echo $page_html; function links($key) { $url = "http://www.metacrawler.com/info.metac/search/web/".urlencode($key); $handle = file($url); while (!isset($handle)) // keep connecting until success { usleep(3000000); //put program to sleep for 3 seconds --- cira set the limit to 1 request per second $handle = file($url); } $contents = implode("", $handle); // put returned html source code file contents into a string //var_dump($contents); $contents = eregi_replace( '', '', $contents); $contents = eregi_replace( '', '', $contents); $contents = strstr($contents, "View Results From"); $contents = strstr($contents, "Search Engines"); //var_dump($contents); // Display Content $item_max = 6; $site_links = ''; for($i = 1; $i < $item_max; $i++) { // Get url $contents = strstr($contents, 'listingmain'); $contents = strstr($contents, 'window.status='); $start_pos = strpos($contents, '"') + 1; $end_pos = strpos($contents, ';') - 16; $url = substr($contents, $start_pos, $end_pos); //echo "URL : $url

"; // Get title $contents = strstr($contents, 'window.status="";return true;'); $start_pos = strpos($contents, ">") + 1; $end_pos = strpos($contents, "<") - 31; $title = substr($contents, $start_pos, $end_pos); //echo "Title : $title

"; // Get description $contents = strstr($contents, '000000'); $start_pos = strpos($contents, ">") + 1; $end_pos = strpos($contents, "<") - 1; $desc = substr($contents, $start_pos, $end_pos); //echo "description : $desc
"; //var_dump($contents); //echo "Url : $url

"; if (!empty($title) and !empty($desc) and !empty($url)) { $site_links .= "

$title
"; $site_links .= "$desc
"; $site_links .= "".((strlen($url) < 60)? $url : substr($url, 0, 57)."...")."

"; } else break; } return $site_links; } ?>