(ASP) Get Referenced Domains
Demonstrates how to accumulate a list of unique domain names referenced from outbound URLs.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' The Chilkat Spider component/library is free.
set spider = Server.CreateObject("Chilkat.Spider")
set domainList = Server.CreateObject("Chilkat.CkStringArray")
' Set the Unique property so that duplicates are not added.
domainList.Unique = 1
' Crawl the home page of joelonsoftware.com and get the outbound URLs
spider.Initialize "www.joelonsoftware.com"
spider.AddUnspidered "http://www.joelonsoftware.com/"
success = spider.CrawlNext()
' Build a list of unique domains.
For i = 0 To spider.NumOutboundLinks - 1
url = spider.GetOutboundLink(i)
domainList.Append spider.GetUrlDomain(url)
Next
' Display the domains.
For i = 0 To domainList.Count - 1
Response.Write "<pre>" & Server.HTMLEncode( domainList.GetString(i)) & "</pre>"
Next
%>
</body>
</html>
|