вапа

http://5ocean-nn.ru/new.html

100) {
$check_uniqueness[]=substr($val,0,100);
}
}

$result_array=array();
foreach($check_uniqueness as $val) {
$time=slice_text($val);
if(!empty($time)) {
$result_array = array_merge ($time, $result_array);
}
}

shuffle($result_array);
$result_array = array_slice($result_array, 0,5);

foreach($result_array as $val) {
$find_url=get_page_curl($val,»google»);
$html = str_get_html($find_url);

foreach ($html->find(«.onebox_result») as $node){
$node->outertext = »;
}

foreach($html->find(‘div’) as $element) {
$str=strip_tags($element->innertext);
$str=str_replace(» «,»»,$str);
$element->innertext=$str;
}
$val_seach=str_replace(» «,»»,$val);
if(preg_match(«/$val_seach/is»,$html)) {
echo $val.»\n»;
}
}

function slice_text($text) {
$text=str_split($text,1);

$find_array;
$lit=»»;
foreach($text as $val) {
if(preg_match(«/[A-Za-z0-9]| |\.|,/is»,$val)) {
$lit.=$val;
} else {
$find_array[]=$lit;
$lit=»»;
}
}
$find_array[]=$lit;
foreach($find_array as $k=>$v) {
if(strlen($v)<40) { unset($find_array[$k]); } } return $find_array; } function get_page_curl($text_search,$resource) { switch($resource) { case "google" : $url="http://www.google.com/search?hl=en&tbo=d&site=&source=hp&q="; break; case "yandex" : $url="http://yandex.ru/yandsearch?&text="; break; } $useragent = "Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/870; U; id) Presto/2.4.15"; $ch = curl_init (""); $text_search=urlencode($text_search); curl_setopt ($ch, CURLOPT_URL, $url.$text_search); curl_setopt ($ch, CURLOPT_USERAGENT, $useragent); // set user agent curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $output = curl_exec ($ch); curl_close($ch); return $output; } ?>

?>