Get the backlinks of your site through Yahoo Api
By Herve le turdu

Update (feb 2012): Yahoo site explorer has been closed due to the cooperation of Bing and Yahoo search. The service has been replaced by bing webmastertool API. More details on how to create a BING WMT request here.

Caution:There seems to be a limitation of 1000 BLs per domain && it seems that you can only see the backlinks from the site that has been verified in Bing Webmaster Tool: a real turn off to the API…

Through the study of the backlinks of your site or the one of your competitor, you can tell many things:

  • Who gives you natural backlinks,
  • which kind of sites do they have,
  • what demografics the web master belong to…

But to make a thorough study over time you need to start somewhere and scrap your (competitors) backlinks;

You can do it by scraping yahoo site explorer or in a more elegant way through Yahoo API. Lets try the API solution http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html

Set the variables

1
2
3
4
5
6
7
8
9
10
11
<?php
 
$api_service_url = "http://search.yahooapis.com/SiteExplorerService/V1/inlinkData";
$apiid = "Your Key";
$query  = "languagekompis.com";
$entire_site  = "";   // "1" to provide results for the entire site
$omit_inlinks = "domain";
$linksperrequest = 10;   // 100 is max value
$startposition = 1;
 
$request_url = sprintf("%s?appid=%s&query=%s&entire_site=%s&omit_inlinks=%s&output=php", $api_service_url, $apiid, urlencode($query), $entire_site, $omit_inlinks);

unserialize() the Yahoo response into an array $data["ResultSet"]["Result"]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$currentpos = 0;
while ($currentpos++ >= 0) {
 
   // Formating API request url
   $requrl = sprintf("%s&start=%s&results=%s", $request_url, ($currentpos-1)*$linksperrequest+$startposition, $linksperrequest);
 
   // Handle errors
   if (($content = file_get_contents($requrl)) === FALSE ) {
   echo "HTTP error: $requrl
";
   exit;
   }
 
   // Unserialize data from response
   $data = unserialize($content);
 
   if (!array_key_exists("ResultSet", $data)) {
   echo "Error: Bad response from server
";
   exit;
   }
 
   // Extracting each link from array
   for ($i=0; $i<sizeof($data["ResultSet"]["Result"]); $i++) {
      $url = $data["ResultSet"]["Result"][$i]["Url"];
      $title = $data["ResultSet"]["Result"][$i]["Title"];
 
      echo '<p><a href="'.$url.'">'.$title.'</a></p>';
 
 
   }
 
   // End loop if no more results
   if (sizeof($data["ResultSet"]["Result"]) < $linksperrequest) break;
}
 
?>

done. Get the title and more from the yahoo response! Yahoo api

Get the best prices on the web



RECENTLY BLOGGED ABT

TWEETS

  • My twitter:

Test of NS:

I will try to insert different elements into it:

Broken TWiTTs :(

  •  

AUTHOR

  • Hervé Le TurduMy name is Herve Le Turdu.
    I am a 32 years old french* man with an inquiring mind and an enthusiastic personality. Get to know me better !

    *Pardon my English tainted with a strong accent and of many mistakes

Projects & Work

LINKS - BeCause they deserve it!

I Love SEOgadget ----------------------------------------------------
Testing stuff:
http://leturdu.com/2010/03/get-the-backlinks-of-your-site-through-yahoo-api/

Test 1 // show post ID: 240

Test 2 // show category page: SEO