简体   繁体   English

使用Wget下载具有格式的网站

[英]Download Website with formatting using Wget

I have a PHP script which runs on our website and echos a bunch of content to the browser, each line has a unique ID. 我有一个PHP脚本运行在我们的网站上,并向浏览器回显一堆内容,每行都有一个唯一的ID。 I installed GnuWin32 and wrote a small BAT script to download this content to a TXT file which is working fine, however when viewed in Notepad it has lost the line breaks. 我安装了GnuWin32,并编写了一个小BAT脚本来将该内容下载到TXT文件中,该文件可以正常工作,但是在记事本中查看时,它丢失了换行符。

I have tried appending "\\r\\n" and "\\n" to the echo string in the PHP script but still have this issue. 我尝试在PHP脚本的回显字符串中附加“ \\ r \\ n”和“ \\ n”,但仍然存在此问题。 Can anyone please point out where my mistake is? 谁能指出我的错误在哪里?

@echo off
setlocal
set TARGET=website.com/report_file.php
wget -O ServerID.txt -p %TARGET%
endlocal

Maybe you have LF ( 0x0a ) terminated lines in your .txt file. 也许您的.txt文件中有LF( 0x0a )终止的行。 Notepad handles CRLF ( 0x0d 0x0a ) terminated lines. 记事本处理CRLF( 0x0d 0x0a )终止的行。

If you are using gnuwin32, you can use conv to change the line endings in your file. 如果使用的是gnuwin32,则可以使用conv更改文件中的行尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM