Feed on
Posts
Comments
  1. function parse_wordstat($keyword) {
  2.  
  3.     $pattern  = ‘/<table border="0" width="100%" cellspacing="0" cellpadding="5">(.*?)< \/table>/is’;
  4.     $pattern2 = ‘/<tr class="tlist".*?><td><a href=".*?">(.*?)< \/a>< \/td>[\n]*<td align=["]*right["]*>([\d]+)< \/td>< \/tr>/is’;
  5.  
  6.     $url = ‘http://wordstat.yandex.ru/advq?rpt=ppc&text=’.urlencode($keyword);
  7.     $data = file_get_contents($url);
  8.  
  9.     preg_match_all($pattern, $data, $out, PREG_SET_ORDER);
  10.  
  11.     foreach ($out as $key=>$value) preg_match_all($pattern2, $value[1], $out2[$key], PREG_SET_ORDER);
  12.  
  13.     return $out2;
  14.  
  15. }
  16.  
  17.  
  18. $ws = parse_wordstat(‘холодильник’);
  19.  
  20. foreach ($ws as $w) {
  21.     echo ‘<hr />’;
  22.     foreach ($w as $k) echo $k[1].‘ | ‘.$k[2].‘<br />’;
  23. }
  24. </td></a></td></tr></table>

источник

Trackback URI | Comments RSS

Leave a Reply

Stocking Club’s Blog © 2008 | MistyLook made free by Reef Sandals