Use Cron to run a php script from a URL

If your php script can be invoked using an URL, you can lynx, or curl, or wget to setup your crontab as shown below.

The following script executes the php script (every hour) by calling the URL using the lynx text browser. Lynx text browser by default opens a URL in the interactive mode. However, as shown below, the -dump option in lynx command, dumps the output of the URL to the standard output.

lynx -dump https://www.thegeekstuff.com/myscript.php

/usr/bin/curl -o temp.txt https://www.thegeekstuff.com/myscript.php

/usr/bin/wget -q -O temp.txt https://www.thegeekstuff.com/myscript.php

Revisions

Tags:

No comments yet.

Leave a Reply