Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   Google keyword grabber (https://forum.antichat.xyz/showthread.php?t=119082)

Exgibichi 04.05.2009 20:14

Google keyword grabber
 
накодил вчера тулзу, решил поделиться, думаю сеошники оценят. Ах да тулза грабит похожие кейворды из гугла.

upd добавил фильтр на наличее кея в фразе

PHP код:

<?php
/* 

|  Google keyword grabber
|  C0d3d by Exgibichi 
|  3/05/09

*/ 
error_reporting(0);
set_time_limit(1000);

if(!
$_POST['key']) {

echo 
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
      <div style="margin:20%">
      <form action="" method="POST">
      <input type="text" name="key" value="viagra">
      Level: 
      <input type="text" name="n" value="2" size="3"><br/><br/>
      <input type="submit" value="Go">
      </form>
      </div>'
;

} else {

  if(!
$_POST['n']) { $n 2; } else { $n $_POST['n']; }
  
  echo 
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >';
  echo 
'<b>key:</b> '.$_POST['key'].' ';
  echo 
'<b>level:</b> '.$n.' ';
  
$startkey $_POST['key'];
  
$k keygrab($startkey);
  
$rx kgr($k$n);
  
$rx array_unique($rx);
  
$cx count($rx);
  echo 
'<b>key grabbed:</b> '.$cx.'<br/><br/>';
  
  foreach(
$rx as $bx) {

    
$bx str_replace('+'' '$bx);
    echo 
$bx.'<br/>';
  }
}

function 
keygrab($firstkey) {

  global 
$startkey;
  
  
$firstkey str_replace(' ','+',$firstkey);  
  
$url 'http://www.google.com/search?q='.urlencode($firstkey); 
  
$file file_get_contents($url) or die('Could not access file'); 
  
$exp "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"

  if(
preg_match_all("/$exp/siU"$file$matchesPREG_SET_ORDER)) { 
  
    foreach(
$matches as $m) {
    
      if(
strstr($m[2],'/search?hl') && !strstr($m[2],'http') && !strstr($m[2],'related')) {
      
        
preg_match('/&q=(.*)&revid/',$m[2],$rx);
        
        if(
strstr($rx[1],'%') && strstr($rx[1], $startkey)) {
        
          
$keys[] = urldecode($rx[1]);
          
        } elseif(
strstr($rx[1], $startkey)) {
        
          
$keys[] = $rx[1];
        }
      }
    }
  }  return 
$keys;
}

function 
dar2sar($array) { 

 for (
$i=0$i<count($array); $i++) {
  
    for (
$j=0$j<count($array[$i]); $j++) {
          
        
$s[] = $array[$i][$j];
    }
  } return 
$s;
}

function 
Clean_null_keys($array) { 

  foreach (
$array as $m) { 
  
    if (!
$m == '') {
      
$t[] = $m;
    }
  } return 
$t;
}

function 
kgr($sarx$n) {

  if(
$n == 0){ return $sarx; }

  foreach(
$sarx as $ax){
    
    if(
$ax) {
      
$cx[] = keygrab($ax);
    }
  }
  
$cx Clean_null_keys($cx);
  
$cx dar2sar($cx);
  
$cx Clean_null_keys($cx);
  
$n--;
  return 
kgr($cx$n);
}
?>


Alexsize 04.05.2009 20:28

Щас оценим.


arginmax
fematril
zestra for women
l-arginine


1) вот этого по кею виагра быть не должно.
2) скинь в ПМ асю, объясню что там еще должно быть)

Gifts 04.05.2009 20:45

http://forum.antichat.ru/thread107524.html


Время: 12:04