|
<%@ Language=VBScript %>
<%
' Local file to store XML
' This file MUST be writable by web server
LOCAL_XML_FILENAME = server.MapPath("local_41717.xml")
Const ForReading = 1, ForWriting = 2
sourceFile = "http://www.text-link-ads.com/xml.php" & "?inventory_key=VHW45R3R22OVFVGS7XDV&referer=" & Server.UrlEncode(Request.ServerVariables("HTTP_REFERER")) & "&user_agent=" & Server.UrlEncode(Request.ServerVariables("HTTP_USER_AGENT"))
styleFormat = "" & _
"" & _
" " & _
" " & _
" " & _
""
Contents = ""
Set FSO = server.createObject("Scripting.FileSystemObject")
' update local XML
If (Int(Rnd() * 24) = 0) Or (FSO.getFile(LOCAL_XML_FILENAME).size < 10) Then
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", sourceFile, False
xmlhttp.send ""
Contents = xmlhttp.responseText
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForWriting, True)
TextStream.Write Contents
TextStream.Close
Set TextStream = nothing
Contents = ""
End If
' read local XML
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForReading, False, -2)
do while not TextStream.AtEndOfStream
Contents = Contents & TextStream.ReadLine
loop
TextStream.Close
Set TextStream = nothing
' parse local XML
Set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadXML(Contents)
Set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.loadXML(styleFormat)
output = source.transformNode(style)
output = Replace(output, "<", "<")
output = Replace(output, ">", ">")
Response.Write output
%>
|