Mohdows Mohdows - 1 year ago 105
PHP Question

What is the differance between CURL, WGET and PHP Cronjob

I am trying to create a cronjob and I don't know what is the difference between those lines, ans which one I am supposed to use to make the Cronjob work correctly.

0 0 * * * /usr/bin/php5.5 /website/cron.php
0 0 * * * /usr/bin/curl /website/cron.php
0 0 * * * /usr/bin/wget /website/cron.php

Now I need to know which one works, I am sure that my server has the CURL and WGET installed by using the commande line:

whereis wget
whereis curl

But when I tried creating a simple php file to send me emails only this code worked for me:

0 0 * * * /usr/bin/php5.5 /website/cron.php

So what to do?

Answer Source

curl and wget are supposed to send a http request(like downloading files/ post data etc.)

cron.php is a php file. You should always use php (whatever version) to execute it.

That's why only 0 0 * * * /usr/bin/php5.5 /website/cron.php worked.

If you really want to use curl or wget, here is an example:

0 0 * * * /usr/bin/curl --silent &>/dev/null
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download