Get the backlinks of your site through Yahoo Api

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

Set the variables

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

$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

   // Unserialize data from response
   $data = unserialize($content);

   if (!array_key_exists("ResultSet", $data)) {
   echo "Error: Bad response from server

   // Extracting each link from array
   for ($i=0; $i'.$title.'

'; } // 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