I’ve seen lots of Yahoo! APIs in hand lately, specially the webmasters-related ones. So, I thought I’d show you one or two :D !!

Yahoo! APIs are kind of lame in the making, pretty easy if you ask me, atleast from a PHP coder’s point of view. Specially with that DOM on ;) . Don’t know what a DOM is? Google it. So you just make up the URL, and call it with a GET. That’s probably just all ;) .

The difference between the two samples I’m putting up is that one has an extra extension, look and see:

Total Number of Backlinks to Page

Use: Whatever php file you called it, just put an extra ?q=<url of page to check backlinks> in the URL.

<?php

$request = 'http://api.search.yahoo.com/SiteExplorerService/V1/inlinkData?appid=YahooDemo&query='.$_GET['q'].'&results=1';$response=file_get_contents($request);
$dom = new DOMDocument('1.0', 'UTF-8');// Load the XML into the DOM
if ($dom->loadXML($response) === false) {
  die('Parsing failed');
}$root = $dom->firstChild;
 foreach($root->attributes as $attr) $res[$attr->name] = $attr->value;echo $res['totalResultsAvailable'];
?>
 
Given that, here is how to make up one that will,

Total Backlinks to The Whole Site

Use: Whatever php file you called it, just put an extra ?q=<url of doamin of site to check backlinks> in the URL.

<?php

$request = 'http://api.search.yahoo.com/SiteExplorerService/V1/inlinkData?appid=YahooDemo&query='.$_GET['q'].'&results=1&entire_site=1';$response=file_get_contents($request);
$dom = new DOMDocument('1.0', 'UTF-8');// Load the XML into the DOM
if ($dom->loadXML($response) === false) {
  die('Parsing failed');
}$root = $dom->firstChild;
 foreach($root->attributes as $attr) $res[$attr->name] = $attr->value;echo $res['totalResultsAvailable'];?>
Congrats! You just got yourself a pretty handy webtool ;) :D !