';
exit;
}
//
function partial_in_array($key,$array) {
foreach($array AS $element) {
if (is_numeric(strpos($element,$key))) {
return $element;
}
}
return;
}
// Function to convert the XML into an array
function xml_to_result($dom) {
global $totalResultsReturned;
$root = $dom->document_element();
$res['totalResultsReturned'] = $root->get_attribute('totalResultsReturned');
$i = 0;
$node = $root->first_child();
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;
}
// Function to display links with all options and information
function show_links ($final_output) {
global $all_sites, $min_match;
echo "
\n";
for ($y = 0; $y < count($all_sites); $y++) {
echo "| ";
echo $y+1;
echo " | \n";
}
echo "Site Name | \n
";
for ($x = 0; $x < count($final_output); $x++) {
if ($final_output[$x]['total'] >= $min_match) {
echo "\n";
$domain = $final_output[$x]['name'];
for ($y = 0; $y < count($all_sites); $y++) {
echo "| ";
if ($final_output[$x][$y] != '') {
echo "X\n";
}
echo " | \n";
}
echo "";
echo "[W] ";
echo "[A] ";
echo "[H] ";
echo "[D] ";
echo "[Y] ";
echo "" . $domain . " ";
echo "(" . gethostbyname($domain) . ") | \n";
echo "
\n";
}
}
}
// Function to display csv
function show_csv ($final_output) {
global $all_sites, $min_match;
for ($y = 0; $y < count($all_sites); $y++) {
echo $y+1;
echo ",";
}
echo "Site Name,IP Address,";
for ($y = 0; $y < count($all_sites); $y++) {
echo $y+1;
echo ",";
}
echo "\n";
for ($x = 0; $x < count($final_output); $x++) {
if ($final_output[$x]['total'] >= $min_match) {
$domain = $final_output[$x]['name'];
for ($y = 0; $y < count($all_sites); $y++) {
if ($final_output[$x][$y] != '') {
echo "X";
}
echo ",";
}
echo "$domain,";
echo gethostbyname($domain) . ",";
for ($y = 0; $y < count($all_sites); $y++) {
if ($final_output[$x][$y] != '') {
echo $final_output[$x][$y];
}
echo ",";
}
echo "\n";
}
}
}
?>
Yahoo Hubfinder 2.0
Hub Finder is a free link analysis tool from www.seobook.com.
- Hub Finder looks for co occuring backlinks, which may be authoritative links
that help satisfy topic dependant link authority algorithms.
- To use Hub Finder enter a subject, and / or competing URLs to analyze linkage
data of top ranked competing sites via the Yahoo! API.
- Questions, comments, feedback? Let
me know what you think.
- If you would like to mirror the tool feel free to grab
the source code.
\n";
if (!isset($query)) done();
$manual_sites = explode("\n",$manual_filter);
$query = str_replace(' ','%20',$query);
$q='http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=' . $query;
foreach ($manual_sites AS $site) {
$q .= '%20-site:' . trim($site);
}
$q .= '&results=' . $search_num . '&appid=linkharvester';
$site_results = file_get_contents($q);
$dom = domxml_open_mem($site_results,DOMXML_LOAD_PARSING,$error);
if ($dom) $res = xml_to_result($dom);
$searched_sites = array();
for ($x = 0; $x < $res[totalResultsReturned]; $x++) {
$url = $res[$x][Url];
$url_array = parse_url($url);
$url = $url_array['host'];
if (!in_array($url,$searched_sites)) array_push($searched_sites,$url);
}
$all_results = array();
$site_count = 0;
$all_sites = array();
if ($individual != '') array_push($all_sites,$individual);
foreach ($manual_sites AS $site) {
if ($site != '') array_push($all_sites,$site);
}
foreach ($searched_sites AS $site) {
if ($site != '') array_push($all_sites,$site);
}
foreach ($all_sites AS $site) {
$site_results_array = array();
$site = trim($site);
if (strlen($site) > 1) {
$query = str_replace('http://','',$site);
$domain = parse_url("http://" . $query);
for ($i = 0; $i < $depth; $i++) {
$start = 50 * $i;
if (($site_count == 0) && ($individual != '') && ($linktype == 'link')) {
$q='http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=link:http://' . str_replace('http://','',$individual) . "%20-site:" . $domain[host];
} else {
$q='http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=linkdomain:' . $domain[host] . "%20-site:" . $domain[host];
}
if ($start == 0) {
$site_results = file_get_contents($q.'&results=50&appid=linkharvester');
} else {
$site_results = file_get_contents($q.'&results=50&appid=linkharvester&start=' . $start);
}
$dom = domxml_open_mem($site_results,DOMXML_LOAD_PARSING,$error);
if ($dom) $res = xml_to_result($dom);
for ($x = 0; $x < $res[totalResultsReturned]; $x++) {
$full_url = $res[$x][Url];
$url_array = parse_url($full_url);
$url = $url_array['host'];
array_push($site_results_array,$full_url);
if (!in_array($url,$all_results)) {
array_push($all_results,$url);
}
}
}
$sites[$site_count] = $site_results_array;
$site_count++;
}
}
$final_output = array();
for ($y = 0; $y < count($all_results); $y++) {
$final_output[$y]['name'] = $all_results[$y];
for ($x = 0; $x < count($all_sites); $x++) {
$this_link = partial_in_array($all_results[$y],$sites[$x]);
if ($this_link != '') {
if (($x == 0) || ($apply != 'mustlink') || ($individual == '') || ($final_output[$y][0] != '')) {
$final_output[$y][$x] = $this_link;
$final_output[$y]['total']++;
}
} else {
$final_output[$y][$x] = '';
}
}
}
foreach($final_output as $result) {
$row_sorting[] = $result['total'];
}
array_multisort($row_sorting, SORT_DESC, $final_output);
if (($individual != '') && ($apply == 'sortby')) {
foreach($final_output as $result) {
$row_sorting2[] = $result[0];
}
array_multisort($row_sorting2, SORT_DESC, $final_output);
}
?>
Querying the following " . count($all_sites) . " sites\n";
for ($y = 1; $y <= count($all_sites); $y++) {
echo "$y: " . $all_sites[$y-1] . "
\n";
}
$num_results = 0;
for ($x = 0; $x < count($final_output); $x++) {
if ($final_output[$x]['total'] >= $min_match) {
$num_results++;
}
}
echo "Showing " . $num_results . " sites with at least " . $min_match . " matching backlinks from " . count($all_results) . " search results
\n";
echo "\n";
show_links($final_output);
?>