$place = false;
$url = false;
foreach($urls[1] as $k=>$link)
{
if(preg_match("#\w+:/(/.+?\.|/)$domain/#",$link))
{
$url = $link;
$place = $k+1;
break;
}
}
$page = ceil($place / 10);
$from = $page;
# Output
if($place) {
$final[4][$keyword] = "#$place";
} else {
$final[4][$keyword] = "NO";
}
} elseif($searchengine == 5) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookieforaltavista.txt");
curl_setopt($ch, CURLOPT_URL, "http://www.altavista.com/web/results?itag=ody&q=".urlencode($keyword)."&kgs=1&kls=0");
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
preg_match_all("/
/smi",$content,$urls);
$place = false;
$url = false;
foreach($urls[1] as $k=>$link)
{
if(preg_match("#\w+:/(/.+?\.|/)$domain/#",$link))
{
$url = $link;
$place = $k+1;
break;
}
}
$page = ceil($place / 10);
$from = ($page * 10)-10;
$url = preg_replace("/http://(.*)http%3a///","http://",$url);
# Output
if($place) {
$final[5][$keyword] = "#$place";
} else {
$final[5][$keyword] = "NO";
}
} elseif($searchengine == 6) {
$content = file_get_contents("http://www.alltheweb.com/search?advanced=1&cat=web&jsact=&_stype=norm&type=all&q=".urlencode($keyword)."&hits=$limit");
preg_match_all("//Usmi",$content,$urls);
$place = false;
$url = false;
foreach($urls[1] as $k=>$link)
{
if(preg_match("#\w+:/(/.+?\.|/)$domain/#",$link))
{
$url = $link;
$place = $k+1;
break;
}
}
$page = ceil($place / 10);
$from = (($page * 10)+1)-11;
$url = preg_replace("/http://(.*)http%3a///","http://",$url);
# Output
if($place) {
$final[6][$keyword] = "#$place";
} else {
$final[6][$keyword] = "NO";
}
}
*/
}
}
echo "
";
# We open the result table
echo "
| |
";
# Here's the search engines columns
foreach($searchenginebox as $searchengine) {
# Here's our search engine row
echo "
$searchengines[$searchengine] |
";
}
echo "
";
# Here's the result columns per keyword
foreach($keywordsarr as $keyword) {
# Here's our keyword
echo "
";
echo "
"$keyword" $domain |
";
foreach($searchenginebox as $key => $searchengine) {
# Here's our result
//echo "
".$final[$key+1][$keyword]. " |
";
echo "
".$final[$searchengine][$keyword]. " |
";
}
echo "
";
}
# We close the result table
echo "
";
/*
echo "
";
print_r($searchenginebox);
print_r($final);
echo "
";
*/
} else {
echo '
* All fields required.
';
}
?>
include("footer.php"); ?>