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/"

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

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.





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

   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.


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


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.


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

Curl Examples
$ curl -O
  % 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


Follow the below link.

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

I am a HPE Employee

Accept or Kudo