Login | Register  

Meta Name Parser ver. 1

by Scud   Saturday, November 26, 2005 Rating:
 Vote this news:


 

You may parse meta names from your site or an external url. Script can display title, description and keywords of selected page. 

 

<html>
<head>
<title>META-NAME PARSER</title>
</head>

<body>

<h1>META-NAME PARSER</h1>
<form method="POST" action="meta-name-parser.asp">
  <p><input type="text" name="url" size="45"><input type="submit" value="PARSE" name="func"></p>
</form>

<%
if request.form("func") = "PARSE" then

  Set objCon = Server.CreateObject ("Microsoft.XMLHTTP")
  objCon.Open "GET", request.form("url"), False, "", ""
  objCon.Send
  strPage = objCon.ResponseText

  Set objRegExp = New RegExp
  objRegExp.IgnoreCase = True  
  objRegExp.Pattern = "<TITLE>([^<]*)</TITLE>"  
  Set objMatch = objRegExp.Execute(strPage)
  if objMatch.Count = 0 Then
   response.write "Title Not Found .. "
   else
   strTitle = objMatch.item(0).Value
   strTitle = Replace(strTitle, "<TITLE>", "", 1, -1, vbTextCompare)
   strTitle = Replace(strTitle, "</TITLE>", "", 1, -1, vbTextCompare)
   response.write strTitle & "<br><br>"
  end if 

  objRegExp.Pattern = "<META[^>]+(name=""description""|content=""([^""]*)"")[^>]+(name=""description""|content=""([^""]*)"")[^>]*>"
  Set objMatch = objRegExp.Execute(strPage)
  if objMatch.Count = 0 Then
   response.write "Description Not Found .. " & "<br><br>"
   else
   strDesc = objMatch.item(0).Value
   strDesc = Mid(strDesc, InStr(1, strDesc, "content=""", vbTextCompare) + 9)
   strDesc = Mid(strDesc, 1, InStr(1, strDesc, """", vbTextCompare) -1)   
   response.write strDesc & "<br><br>"
  end if   
 
  objRegExp.Pattern = "<META[^>]+(name=""keywords""|content=""([^""]*)"")[^>]+(name=""keywords""|content=""([^""]*)"")[^>]*>"
  Set objMatch = objRegExp.Execute(strPage)
  if objMatch.Count = 0 Then
   response.write "Keywords Not Found .. "
   else
   strKeywords = objMatch.item(0).Value
   strKeywords = Mid(strKeywords, InStr(1, strKeywords, "content=""", vbTextCompare) + 9)
   strKeywords = Mid(strKeywords, 1, InStr(1, strKeywords, """", vbTextCompare) -1)
   response.write strKeywords & "<br><br>"
  end if
end if
%>

</body>

</html>





Dotnetindex.com is listed with 411asp.net
Dotnetindex.com is listed with aspin.com
Dotnetindex.com is listed with jspin.com
PHP, ASP, .NET, JSP Resources, Reviews







page counter
Copyright © 2007 Powered by GNews Publisher Positive. All rights reserved. Contact Us - Load Time: 0.19 second(s)