(.+?)%ms',$contents,$matches))
{
$narrow = $matches[1][0];
$more = @$matches[1][1];
if (preg_match_all('%
(.+?) | %ms',$narrow,$matches))
{
foreach ($matches[1] as $match) {
$kws1[] = trim(strtolower(strip_tags($match)));
}
}
if ($more && preg_match_all('%(.+?) | %ms',$more,$matches))
{
foreach ($matches[1] as $match) {
$kws1[] = trim(strtolower(strip_tags($match)));
}
}
}
foreach ($kws1 as $value)
{
$kw = $value;
$contents = file_get_contents("http://www.ask.com/web?q=".urlencode($kw));
if (preg_match_all('%(.+?)%ms',$contents,$matches))
{
$narrow = $matches[1][0];
$more = @$matches[1][1];
if (preg_match_all('%(.+?) | %ms',$narrow,$matches))
{
foreach ($matches[1] as $match) {
$kws2[] = trim(strtolower(strip_tags($match)));
}
}
if ($more && preg_match_all('%(.+?) | %ms',$more,$matches))
{
foreach ($matches[1] as $match) {
$kws2[] = trim(strtolower(strip_tags($match)));
}
}
}
}
$kws3 = array_merge($kws1, $kws2);
array_unique($kws3);
print join("
",$kws3);
?>