Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal, olha que coisa sem senso...
Estou capturando o conteúdo de uma página usando XML pra depois gravar esse conteúdo em um arquivo TXT.
O conteúdo é exibido corretamente na tela, mas o arquivo TXT gerado não armazena nadinha! O arquivo fica com zero bytes!
O que será que está errado?
<head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT"><meta http-equiv="Cache-Control" content="no-store"><meta http-equiv="Refresh" content="60"></head><%Set ObjXmlHttp = Server.CreateObject("MsXml2.XMLHTTP")Set FSO = Server.CreateObject("Scripting.FileSystemObject") On Error Resume NextRodada_Atual= "QUI1340"Nome_Arquivo = "teste.txt"Arquivo = "http://10.8.4.157/sex0700/timeout.txt"Response.Write "Processando arquivo " & Arquivo & " para geração do arquivo " & Nome_Arquivo & ": <br><br>"ObjXmlHttp.Open "GET", Arquivo, False ' Send it on it's merry way.ObjXmlHttp.Send' Get the text of the response.' This object is designed to deal with XML so it also has the following properties: ResponseBody, ResponseStream, and ResponseXML. We just want the text so I use:StrHTML = ObjXmlHttp.ResponseText' Trash our object now that I'm finished with it.Set ObjXmlHttp = Nothing 'Se ocorrer algum erroIf Err Then StrHTML = "Arquivo Inexistente!"Response.Write StrHTML & "<br>"Set File = FSO.CreateTextFile("c:\robo novo\" & Nome_Arquivo)File.Write StrHTMLFile.CloseResponse.Write "-------------------------------------------------------------------------------------------------------------------------------------------------------------------"&"<br>"' -----| Não houve conexão com banco de dados;' -----| Encerrando script;%>
Olah...Meu.. pode parecer besteira o que vou falar, mas nao custa tentar...Tenho uma pagina que gera TXT e ao inves de usar objeto.Write variavel eh usado objeto.WriteLine variavel...Tenta isso.. das veiz, fununcia... depois me fala.... Inteh.