Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert wget cron command to curl

I would like to change the following wget cron commands to curl format:

wget https://www.yoursite.com/index.php?route=cronjob/cronjob -O /dev/null

wget --quiet --delete-after "http://www.yoursite.com/index.php?route=cron/abandoned_cart_reminder&secret_code=yourcode"

Thank you!

like image 455
BigMac Avatar asked Jul 30 '14 17:07

BigMac


People also ask

Can you replace wget with curl?

Answer: 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). However curl provides APIs that can be used by programmers inside their own code.

Which is better wget or curl?

Wget is a simple transfer utility, while curl offers so much more. Curl provides the libcurl library, which can be expanded into GUI applications. Wget, on the other hand, is a simple command-line utility. Wget supports fewer protocols compared to cURL.

How is curl different from wget?

Bidirectional: curl offers upload and sending capabilities. Wget only offers plain HTTP POST support. HTTP multipart/form-data sending, which allows users to do HTTP "upload" and in general emulate browsers and do HTTP automation to a wider extent.

What is curl command?

curl is a command-line tool to transfer data to or from a server, using any of the supported protocols (HTTP, FTP, IMAP, POP3, SCP, SFTP, SMTP, TFTP, TELNET, LDAP, or FILE). curl is powered by Libcurl. This tool is preferred for automation since it is designed to work without user interaction.


1 Answers

The commands wget and curl can be used (fairly) similarly if you just want to download something from a URL. Note that the following is available in the man documentation for each command.

Syntax

wget [options] [URL]
curl [options] [URL]

Options

To specify a download location, wget uses -O while curl uses -o.

To silence output, wget uses --quiet while curl uses --silent.

To delete every file that is downloaded upon completion, wget uses --delete-after. I don't believe curl has a related option (or it may do this automatically).


So a direct translation of your first command would be:

wget https://www.yoursite.com/index.php?route=cronjob/cronjob -O /dev/null
curl https://www.yoursite.com/index.php?route=cronjob/cronjob -o /dev/null

Make sense?

There are lots of examples online and extensive documentation on the man page for each command.

like image 106
Casey Falk Avatar answered Sep 21 '22 14:09

Casey Falk