Reputation: 25
I have been using WGET to download the following file:
wget http://www.fsnradionews.com/FSNNews/FSNHeadlines.mp3
This works perfectly but I want to do the same thing using CURL. If I use:
curl -L -O http://www.fsnradionews.com/FSNNews/FSNHeadlines.mp3
..the file downloads BUT rather than being the audio file, it contains the following HTML:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource could not be found on this server.</p>
<p>Additionally, a 406 Not Acceptable
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
Having researched the problem, many have suggested the request is being redirected hence why I added the -L, but this doesn’t appear the fix the issue.
Any suggestions?
Upvotes: 1
Views: 4274
Reputation: 610
It looks like the server is not accepting the User-Agent. You can supply a common user agent like Mozilla/4.0
with the -A
option in curl. The final command would become:
curl -O http://www.fsnradionews.com/FSNNews/FSNHeadlines.mp3 -A "Mozilla/4.0"
Upvotes: 1
Reputation: 916
Did you try
curl http://www.fsnradionews.com/FSNNews/FSNHeadlines.mp3 -o FSNHeadlines.mp3
?
Should download the file from http://www.fsnradionews.com/FSNNews/FSNHeadlines.mp3
and save it as FSNHeadlines.mp3
.
Upvotes: 0