Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
function position_update($position_update, $id_key = 0){
if($id_key == 0){
$id_key = $position_update;
}
$qexist = mysql_query('select * from `position` where `id`="'.intval($id_key).'"');
if(mysql_num_rows($qexist) <= 0){
echo "<h1 style='color:red'>Ключевика нет в базе.</h1><meta http-equiv='refresh' content='3; url=index.php?'>";
}else{
//вытаскиваем,
$keyword = mysql_fetch_array($qexist);
$site = mysql_fetch_array(mysql_query('select * from `sites` where `id`="'.$keyword['id_site'].'"'));
$new_g = 0;
//проверяем,
$serp = $this->seoclass->google_serp($site['region'],$keyword['keyword']);
if(empty($serp)){
die('Google плохой, Google забанил :\'(');
}
foreach($serp as $k => $v ){
$url = parse_url(str_replace('/interstitial?url=','',$serp[$k]['url']));
//попал!
if($url['host'] == $site['url'] || $url['host'] == 'www.'.$site['url']){
$new_g = $k+1;
}
}
if($new_g != $keyword['new_g']){
//обновляем
mysql_query('update `position` set `new_g`="'.$new_g.'" where `id`="'.intval($id_key).'"') or die(mysql_error());
mysql_query('update `position` set `old_g`="'.$keyword['new_g'].'" where `id`="'.intval($id_key).'"') or die(mysql_error());
mysql_query('update `position` set `cdate`="'.time().'" where `id`="'.intval($id_key).'"') or die(mysql_error());
}
}
}
public function google_serp($region,$text,$start=0,$num=100)
{
$num = $num<=100 ? $num : 100;
/*$text=str_replace('И','И',$text);
$text=str_replace('ш','ш',$text);
*/
$content = $this->_curl_session('http://www.google.'.$region.'/search?q='.urlencode($text).'&ie=utf-8&num='.$num.'&start='.$start);
preg_match_all('(<h3 class=\"r\"><a href=\"(.*)\".*>(.*)</a></h3>)siU',$content,$url_n_title);
preg_match_all('(<div class=\"s\">(.*)<br><span class=f><cite>)siU',$content,$snippet);
foreach ($url_n_title[1] as $key=>$val)
{
$out[]=array (
'title'=>@strip_tags($url_n_title[2][$key]),
'snippet'=>@strip_tags($snippet[1][$key]),
'url'=>@strip_tags($val)
);
}
return $out;
}
А самое главное на phpбесплатная, все пироги
*** скрытое содержание ***