Languages and Scripting

how to download a file using curl or wget | https

 
Shabu Khan-2
Frequent Advisor

how to download a file using curl or wget | https

Hello Folks:

I am trying to download a file using curl from a website that's on the cloud, its a backup zip file. The zip file that it downloads is not a zip file but ascii file with html code.

I've tried various combinations/swtiches, but nothing helps. Here are a few things I tried:

$ curl -u username:password -L -J -O "https://FQDN/index.php?/admin/subscription/get_export/2/filename.zip"

$ curl -u username:password -L -J "https://FQDN/index.php?/admin/subscription/get_export/2" -o output.zip

If I hover over the actual zip file (that I want to download) in the browser I only see this: https://FQDN/index.php?/admin/subscription/get_export/2

and the zip file is the only zip file on that page the URL in the navigation bar in the browser shows this: https://FQDN/index.php?/admin/subscription#

Any thoughts?

Thank you.

 

 

 

 

2 REPLIES 2
Steven Schweda
Honored Contributor

Re: how to download a file using curl or wget | https

> Any thoughts?

   Without an actual URL or the actual "html code", all you get is
guesswork.

   I'd guess that the web page uses active content (JavaScript), perhaps
to prevent people from doing exactly what you want to do.  And curl or
wget can't interpret it.

SanjeevGoyal
HPE Pro

Re: how to download a file using curl or wget | https

Hello,

Follow as below.

On a high-level, both wget and curl are command line utilities that do the same thing.

They both can be used to download files using FTP and HTTP(s).
You can also send HTTP POST request using curl and wget
However curl provides APIs that can be used by programmers inside their own code. curl uses libcurl which is a cross-platform library.
wget is just a command-line tool without any APIs.
Curl also supports lot more protocols that wget doesn’t support. For example: SCP, SFTP, TFTP, TELNET, LDAP(S), FILE, POP3, IMAP, SMTP, RTMP and RTSP.
There is a major advantage of using wget. wget supports recursive download, while curl doesn’t.

Wget Examples
The following example downloads the file and stores in the same name as the remote server.

wget http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2

The following example download the file and stores in a different name than the remote server. This is helpful when the remote URL doesn’t contain the file name in the url as shown in the example below.

wget -O taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701

Curl Examples
$ curl -O http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 28 3762k   28 1085k    0     0  72771      0  0:00:52  0:00:15  0:00:37 54267


OR

Follow the below link.

https://rakeshjain-devops.medium.com/download-files-and-directories-from-web-using-curl-and-wget-9217bc2e34c9


If you feel this was helpful please click the KUDOS! thumb below and accept the solution.
Regards,


I am a HPE Employee

Accept or Kudo