<% dim fs,fname Dim srcFile srcFile = "http://www.historictours.com/trusted-tours/trustedtours.xml" 'srcFile = "http://trustedtours.com/xml/pstore01.xml" 'Nothing Below Here Has To Change Response.Buffer = True Dim objXMLHTTP, xml ' Get length of string ' walk through char by char and if not in legal set, replace with something legal Function cleanse (mstr) len_mstr = len(mstr) for x = 1 to len_mstr ch = mid(mstr, x, 1) if (asc(ch) > 127 ) Then ostr = ostr & " " else ostr = ostr & ch Next cleanse = ostr End function function strdate() dstr = FormatDateTime(Date()) a = split(dstr, "/") m = a(0) d = a(1) y = a(2) if len(d) < 2 then d = "0" & d if len(m) < 2 then m = "0" & m strdate = y & m & d end function 'Response.write strdate() ' Create an xmlhttp Object and Get it! Set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.Open "GET", srcFile, False xml.Send 'Write Text to File 'Response.Write xml.responseText 'Response.write (Server.MapPath("fileck.php") ) set fs=Server.CreateObject("Scripting.FileSystemObject") set fname=fs.CreateTextFile("C:\websites\historictours_com\trusted-tours\xml\incoming.xml",true) 'tmp = xml.responseText 'fred = tmp 'fred = cleanse(tmp) 'Response.write tmp 'fname.WriteLine(fred) fred = xml.responseText 'fred = replace(fred , chr(175), " ") ' repace registred trademark symbols ... seee if replace is much faster if (len(fred) > 10) Then ' if we have data then shift the files... arrLines = split(fred, vbCrLF) 'Set objFile=objFSO.CreateTextFile(strFilePath) For x=0 To UBound(arrLines) ' If (iLineNumber-1)=x Then objFile.WriteLine(strData) 'Response.write "
-> Writing line: " & cStr(x) & arrLines(x) ' DIAGNOSTIC ->The correct line count prints out as the file is executing... fname.WriteLine(arrLines(x)) Next Set xml = Nothing fname.Close 'Response.end() '©® ' ' set fname=nothing 'set fs=nothing If (fs.FileExists("C:\websites\historictours_com\trusted-tours\xml\trustedtours.xml"))=true Then ' Neet to rename it to date file fs.CopyFile "C:\websites\historictours_com\trusted-tours\xml\trustedtours.xml", "C:\websites\historictours_com\trusted-tours\xml\" & strdate() & ".xml", true 'fs.DeleteFile ("C:\websites\historictours_com\trusted-tours\xml\trustedtours.xml") fs.CopyFile "C:\websites\historictours_com\trusted-tours\xml\incoming.xml", "C:\websites\historictours_com\trusted-tours\xml\trustedtours.xml",true 'fs.DeleteFile "C:\websites\historictours_com\trusted-tours\xml\incoming.xml" End If Response.write "XML Feed Grabber Executed Successfully" Else Response.write "XML Feed Grabber had problems obtaining the xml file from HTA" End If ' we have data 'then rename incoming.xml -> trustedtours.xml ' we will end up with files: 'trustedtours.xml '20080608.xml '20080605.xml '20080601.xml %>