Cron – How to use curl in a cron job

croncurl

I need to set up a cron job in cpanel that calls a URL (on the same server) once a week. I was going to use wget but it turns out this is disabled on the shared server being used.

Is there an alternative to wget? I've heard that curl can be used but I don't know how to set that up in a cron command.

Also, what's the command to make the cronjob do nothing on completion?

Any ideas greatly appreciated!

Best Answer

instead of using wget, curl works like this:

curl --silent http://domain.com/cron.php

which will work in the same way as wget. if its a php file you are launching, is there any reason you cant run it via the command line php interpreter like so:

php -q /path/to/cron.php

same on a webserver request and often will work much faster and without certain timeout restrictions present when called via webserver/curl