November 26th, 2007 by mescalito
function parse_wordstat($keyword) {
$pattern = '/
(.*?)< /table>/is’;
$pattern2 = ‘/
| (.*?)< /a>< /td>[n]*
| ([d]+)< /td>< /tr>/is’;
$url = ‘http://wordstat.yandex.ru/advq?rpt=ppc&text=’.urlencode($keyword);
$data = file_get_contents($url);
preg_match_all($pattern, $data, $out, PREG_SET_ORDER);
foreach ($out as $key=>$value) preg_match_all($pattern2, $value[1], $out2[$key], PREG_SET_ORDER);
return $out2;
}
$ws = parse_wordstat(’холодильник’);
foreach ($ws as $w) {
echo ‘ ‘;
foreach ($w as $k) echo $k[1].’ | ‘.$k[2].’‘;
}
|
-
function parse_wordstat($keyword) {
-
-
$pattern = ‘/<table border="0" width="100%" cellspacing="0" cellpadding="5">(.*?)< \/table>/is’;
-
$pattern2 = ‘/<tr class="tlist".*?><td><a href=".*?">(.*?)< \/a>< \/td>[\n]*<td align=["]*right["]*>([\d]+)< \/td>< \/tr>/is’;
-
-
$url =
‘http://wordstat.yandex.ru/advq?rpt=ppc&text=’.
urlencode($keyword);
-
-
-
-
-
foreach ($out as $key=>
$value) preg_match_all($pattern2,
$value[1],
$out2[$key], PREG_SET_ORDER
);
-
-
return $out2;
-
-
}
-
-
-
$ws = parse_wordstat(‘холодильник’);
-
-
foreach ($ws as $w) {
-
-
foreach ($w as $k) echo $k[1].
‘ | ‘.
$k[2].
‘<br />’;
-
}
-
</td></a></td></tr></table>
источник
Posted in Bussines-on-line |
Leave a Reply