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
!!
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);Congrats! You just got yourself a pretty handy webtool
$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'];?>
!
July 24, 2007 at 8:49 pm
Directory of Human Edited Links
Portal-Web.biz – Directory of Human Edited Links – Free Submit in 48 hours
November 30, 2007 at 10:47 pm
Great script.
Thx
December 13, 2007 at 12:46 pm
I better use the google webmaster tool. thanks for the info
April 22, 2009 at 9:00 am
It gives me the following error
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in /home/.labelling/shefeek/shefeekj.com/getbl.php on line 5
Parsing failed
Plss help