så er Title også inkluderet:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<SCRIPT LANGUAGE=JSCRIPT RUNAT=SERVER>
/*
HTTPSocket
by Joshua J Baker - josh@cobaltcreative.com
Designed for the Socket.dll by Dimac
*/
function HTTPSocket_2(URL){
/* Define the main properties */
this.URL = URL;
this.Port = 80;
this.Method = "GET";
this.Protocol = "HTTP";
this.Headers = new Object();
this.FullContent = "";
this.Head = "";
this.Content = "";
this.SendBuffer = "";
this.StoreBuffer = "";
this.Version = "1.0";
this.TimeOut = 10000;
/* Parse the URL */
URL = URL.split(":");
switch (URL.length) {
case 3:
this.Protocol = URL[0].toUpperCase ();
this.Host = URL[1].indexOf("//")==0?URL[1].substring(2).split("/")[0]:URL [0];
this.Port = parseInt(URL[2]).toString ();
this.Query = URL[2].substring (this.Port.length);
break;
case 2:
this.Host = URL[1].indexOf("//")==0?URL[1].substring(2).split("/")[0]:URL [0];
this.Protocol = (URL[1].indexOf("//")==0?URL[0]:this.Protocol).toUpperCase ();
this.Port = URL[1].indexOf("//")==0?this.Port:parseInt(URL[1]).toString ();
this.Query = URL[1].indexOf("//")==0?URL[1].substring(2+this.Host.length): (URL[1].split("/").length>1?URL[1].substring (this.Port.length):"/");
break;
case 1:
this.Host = URL[0].split("/")[0]
this.Query = URL[0].indexOf("/")<URL[0].length-1&&URL [0].indexOf("/")!=-1?URL[0].substring (this.Host.length):"/";
}
this.AddHeader = function(Name, Value){
this.Headers[Name] = Value;
}
this.RemoveHeader = function(Name) {
this.Headers[Name] = false;
}
this.Execute = function() {
this.SendBuffer = this.Method + " " + this.Query + " " + this.Protocol + "/" + this.Version + "\n";
for (prop in this.Headers)
this.SendBuffer += !this.Headers[prop]?"":prop + ": " + this.Headers[prop] + "\n";
this.SendBuffer += "\n";
var Socket = Server.CreateObject ("Socket.TCP");
Socket.TimeOut = this.TimeOut;
Socket.Host = this.Host + ":" + this.Port;
Socket.Open ();
Socket.SendText (this.SendBuffer);
Socket.WaitForDisconnect ();
this.StoreBuffer = Socket.Buffer;
Socket.Close ();
var j = this.StoreBuffer.indexOf("\n\r\n"), k = this.StoreBuffer.indexOf ("\n\n");
this.Head = ((j < k && j > -1)||(j > -1 && k == -1))?this.StoreBuffer.substring(0, j - 1):((k < j && k > -1)||(k > -1 && j == -1))?this.StoreBuffer.substring(0, k):this.StoreBuffer;
this.Content = ((j < k && j > -1)||(j > -1 && k == -1))?this.StoreBuffer.substring(j + 3):((k < j && k > -1)||(k > -1 && j == -1))?this.StoreBuffer.substring(k + 3):this.StoreBuffer;
return this.Content;
}
}
function HTTPSocket(URL){
/* For creating a HTTPSocket in VBScript */
return new HTTPSocket_2(URL);
}
</SCRIPT>
<%
Set Sock = HTTPSocket("
www.altavista.com")
Sock.AddHeader "User-Agent", "My Browser"
output = Sock.Execute()
oldoutput = output
output = LCase(output)
do while not AtEndOfSearch
if temppos = "" then
temppos = 1
end if
startpos = InStr(temppos, output, "<meta")
if startpos <> 0 then
endpos = InStr(startpos, output, ">")
if endpos <> 0 then
curmetatag = Mid(output, startpos, endpos-startpos+1)
if InStr(curmetatag, "description") <> 0 then
metastart = InStr(curmetatag, "content")
if metastart <> 0 then
metaend = InStr(metastart, curmetatag, ">")
if metaend <> 0 then
metastart = metastart + 9
curmetawords = Mid(curmetatag, metastart, metaend - metastart-1)
response.write "<b>meta-description:</b> " & curmetawords & "<br><br>"
end if
end if
else
if InStr(curmetatag, "keywords") <> 0 then
metastart = InStr(curmetatag, "content")
if metastart <> 0 then
metaend = InStr(metastart, curmetatag, ">")
if metaend <> 0 then
metastart = metastart + 10
curmetawords = Mid(curmetatag, metastart, metaend - metastart-1)
response.write "<b>meta-keywords:</b> " & curmetawords & "<br><br>"
end if
end if
end if
end if
temppos = endpos
end if
else
AtEndOfSearch = True
end if
loop
startpos = InStr(output, "<title>")
if startpos <> 0 then
endpos = InStr(output, "</title>")
if endpos <> 0 then
curtitle = Mid(oldoutput, startpos+7, endpos-startpos)
response.write "<b>titel:</b> " & curtitle & "<br><br>"
end if
end if
%>
</body>
</html>
/ortrak