Click here to Skip to main content
15,887,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to download text file which is in remote server. If I use wget or curl -O to download sometimes it put html code inside downloaded text file.

For example if text file name is text.txt which contain a line "hello world"

by using- wget
wget http://url/text.txt

or

curl -O http://url/text.txt

Now in local system text.txt have something like:
<html><head><meta name="viewport" content="width=device-width,initial-scale=1"></head><frameset border="0" rows="100%,*" cols="100%"
                        frameborder="no"><frame name="TopFrame"
                        scrolling="yes" noresize src="http:url"><frame name="BottomFrame" scrolling="no"
                        noresize><noframes></noframes></frameset></html>



I have also tried with many options with wget but cannot get any correct answer.
Can anyone please help me...

What I have tried:

I have also tried with many options with wget but cannot get any correct answer.
Can anyone please help me...
Posted
Updated 6-Apr-18 0:29am

1 solution

wget and curl retrieve and store files as they are. If you got unexpected data they are delivered in that format by the server.

For testing purposes you can use the wget option --save-headers to check the Content-Type send by the server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900