your site.

Hub Finder

"); if (isset($_POST['urls'])) { $urls = explode("\n",$_POST['urls']); if(count($urls) < 2) { echo "You must enter at least 2 urls.
try again
"; die(); } $y = count($urls); $resultsarray = array(); $qcount = 1; $queries = array(); $y1 = $y + 1; if(count($urls) > 10) { die("11 or more is too many sorry
try again
"); } define('Y',count($urls)); define('Y1',Y+1); //echo "Y: ".Y.", Y1: ".Y1; for($i = 1; $i < Y; $i++) { for($j=2;$j$i) { echo "Query $qcount...
"; flush(); ob_flush(); $q = "link:".$urls[$i-1]." link:".$urls[$j-1]; $queries[$qcount] = $q; $resultsarray[$i][$j] = getResults($q); $indexarray[$i][$j] = $qcount; $qcount++; } } } $array = $resultsarray; $finalar = array(); $count = array(); $keys = array(); $z = 0; $x = 1; for($i = 1; $i < Y; $i++) { for($j=2; $j$i) { $results = $array[$i][$j]; if(count($results) > 0) { foreach($results as $result) { $domain = md5($result['url']); if($count[$domain]<1) { $count[$domain] = 1; $inq = array(); $inq[] = "link:".$urls[$i-1]." link:".$urls[$j-1]; $in=array(); $in[$i] = 1; $in[$j] = 1; $finalar[$z] = array("url"=>$result['url'],"count"=>2,"inq"=>$inq,"in"=>$in); $keys[$domain]=$z; $z++; } else { $count[$domain]++; $k = $keys[$domain]; $invi = "in".$i; $invj = "in".$j; $finalar[$k]['in'][$i] = 1; $finalar[$k]['in'][$j] = 1; $finalar[$k]['count'] = count($finalar[$k]['in']); $finalar[$k]['inq'][] = "link:".$urls[$i-1]." link:".$urls[$j-1]; } } } } } } $finalarbk = $finalar; $url = array(); $count = array(); $in1 = array(); $in2 = array(); $in3 = array(); $in4 = array(); $in5 = array(); foreach ($finalar as $key => $row) { $url[$key] = $row['url']; //[$key] = $row['count']; $in[$key] = $row['in']; $count[$key] = $row['count']; } array_multisort($count, SORT_DESC, $url, SORT_ASC, $in, SORT_DESC, $finalar); echo "

Results!

"; echo "Starting URLS:
    "; foreach($urls as $url) { echo "
  1. ".$url."
  2. "; } echo ""; echo ""; for($i = 1; $i < Y1; $i++) { echo ""; } echo ""; foreach($finalar as $u) { echo ""; for($i = 1; $i < Y1; $i++) { if($u['in'][$i]) echo ""; else echo ""; } echo "\n"; } echo "
    $iURL
    X".$u['url']."
    ";
    		//print_r($finalar);
    		//print_r($array);
    		echo "
    "; } else { echo("
    "); echo("Enter at least 2 and up to 10 URLS, include http://:
    "); echo(""); echo("
    "); } function getResults($query,$start=0) { if($start > 949) return false; $urls = array(); $appid = 'Hub-Finder'; $q = '?query='.rawurlencode($query); if($start>0) $q.="&start=".$start; $q .= "&results=50&appid=$appid"; $xml = file_get_contents("http://api.search.yahoo.com/WebSearchService/V1/webSearch".$q); if (!$dom = domxml_open_mem($xml,DOMXML_LOAD_PARSING,$error)) { echo "XML parse error\n";die(); }; $res = xml_to_result($dom); $first = $res['firstResultPosition']; $last = $first + $res['totalResultsReturned']-1; //echo "

    Matched ${res[totalResultsAvailable]}, showing $first to $last

    \n"; for($i=0; $i<$res['totalResultsReturned']; $i++) { foreach($res[$i] as $key=>$value) { if($key == 'Url') $urls[] = array("url"=>$value); } } // print_r($res); // echo "TOTAL RESULTS AVAILABLE: ".$res['totalResultsAvailable']." Lat: $last"; if($res['totalResultsAvailable'] > $last) { //echo "TRYING TO GET MORE"; $newurls = getResults($query,$start+50); if($newurls) foreach($newurls as $u) $urls[]=$u; return $urls; } else return $urls; } // Now traverse the DOM with this function // It is basically a generic parser that turns limited XML into a PHP array // with only a couple of hardcoded tags which are common across all the // result xml from the web services function xml_to_result($dom) { $root = $dom->document_element(); $res['totalResultsAvailable'] = $root->get_attribute('totalResultsAvailable'); $res['totalResultsReturned'] = $root->get_attribute('totalResultsReturned'); $res['firstResultPosition'] = $root->get_attribute('firstResultPosition'); $node = $root->first_child(); $i = 0; while($node) { switch($node->tagname) { case 'Result': $subnode = $node->first_child(); while($subnode) { $subnodes = $subnode->child_nodes(); if(!empty($subnodes)) foreach($subnodes as $k=>$n) { if(empty($n->tagname)) $res[$i][$subnode->tagname] = trim($n->get_content()); else $res[$i][$subnode->tagname][$n->tagname]=trim($n->get_content()); } $subnode = $subnode->next_sibling(); } break; default: $res[$node->tagname] = trim($node->get_content()); $i--; break; } $i++; $node = $node->next_sibling(); } return $res; } /* // Ok, now that we have the results in an easy to use format, // display them. It's quite ugly because I am using a single // display loop to display every type $first = $res['firstResultPosition']; $last = $first + $res['totalResultsReturned']-1; echo "

    Matched ${res[totalResultsAvailable]}, showing $first to $last

    \n"; */ //$a = getResults("link:http://www.eadz.co.nz/",0); //print_r($a); ?>

    powered by Yahoo! Search

free link analysis tool by www.SeoBook.com