Script to Find Inbound Links from Yahoo Site Explorer - Asp .net version

Track inbound links at Yahoo, Discover how many pages link to your website Yahoo developers network has the script written on PHP. I just developed the code to work on ASP. You can read more about the Yahoo Site Explorer Inbound Links at http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html.

The Inlink Data service allows you to retrieve information about the pages linking to a particular page or pages within a domain. You can get more information on Site Explorer at http://help.yahoo.com/help/us/ysearch/siteexplorer/index.html.

This script is developed by webcosmo.com, a free classified advertising site. Webcosmo is offering classified ads on jobs, housing, community, services, for sale, gigs, resumes, personals, events, and much more. Webcosmo is a non-commercial site offering 100% free service to the communities of more then 12 countries, including USA, UK.

This script worked under test and being used by BlogStorm.co.uk users. If any questions or need help please email at info@webcosmo.com

Instructions:
  • Get the Yahoo API Key from developer.yahoo.com/wsregapp/index.php
  • Copy the script below, paste it on a text editor e.g. Notepad or Textpad.
  • Change the appId with the Yahoo Api Key you got.
  • Save the file named as "LinkTrackerByWebCosmo.aspx" or your choice. Please note here that, the extension of the file is .aspx.
  • Upload the file on your server.

This script expects a QueryString variable named as "url" which should contain the url of the link to search for inbound links.

 

*************************************************************************************************

<%@ Language=C# %>
<%@Import namespace= 'System.Net' %>
<%@Import namespace= 'System.Xml' %>
<HTML>
<script runat="server" language="C#">
private void Page_Load(object sender, System.EventArgs e)
{
XmlTextReader reader=null;
try
{

//Change the appId variable(marked with *s below) with yours

String appId="**************************************";

if(Request.QueryString["url"]==null || Request.QueryString["url"].ToString().Trim()=="")
{
Response.Write("0");
return;
}
String url=Request.QueryString["url"].ToString();

String request="http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid="+appId+"&query="+url+"&output=string: xml&omit_inlinks=domain";


reader=new XmlTextReader(request);
reader.WhitespaceHandling = WhitespaceHandling.None;

while(reader.Read())
{
if(reader.NodeType==XmlNodeType.Element)
{
if(reader.Name.ToLower()=="resultset")
{
Response.Write(reader.GetAttribute("totalResultsAvailable"));
break;
}
}
}
}
catch(Exception ex)
{
Response.Write("0");
}
finally
{
if (reader!=null)
reader.Close();
}
}
</script>
<body>
<form id="MyForm" runat="server">
</form>
</body>
</HTML>
                            

*************************************************************************** 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Manik
Posted on: 10/3/2007 at 10:43 AM
Tags:
Categories: Programming / Coding
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Comments are closed