apt get life

Life around technology

  • Technology
    • Guides
    • Linux
    • Development
      • Laravel
    • Misc
    • Raspberry Pi
  • Writing
  • Crafts
    • Crochet
    • Model Making
    • Painting
  • Privacy Policy
You are here: Home / Archives for command line

Run a Remote PHP Web Script from the Command Line with WGET

2012/10/03 by sudo

So, you have a webpage that runs a script which you need to automate? Command line and contab to the rescue!

 

Wget, the linux command line tool can “get” PHP pages and execute them, displaying the contents in an output file. This makes it incredibly useful for managing automated jobs inside content management systems. It’s really simple to use:

wget -q -O output.log "http://example.com/example_script.php"

wget simply runs setting the output to a logfile with the request at your webpage’s script as a full URL. Quotes around the URL are highly recommended. You can tell if the script has finished by looking at output.log and making sure the closing HTML tag is there.

It’s really easy to add this to a crontab for automation. Simply edit your crontab from the terminal interface (crontab -e) and add the line as you require:

0 6 * * * wget -q -O output.log "http://example.com/example_script.php"

This runs the wget command at 6am every day.

Filed Under: Guides, Technology Tagged With: command line, php, wget

Recent Posts

  • Disable iLO on HP Microserver Gen8
  • Ubuntu Desktop 24.04 Change Wallpaper Settings
  • Customising Ubuntu Desktop 24.04
  • Remove domains from Let’s Encrypt using Certbot
  • Install Jetbrains Toolbox on Ubuntu 22.04

Tags

API auditing crochet data recovery debian debudding development Dingo API docker email Getting started with Laravel 5 & Dingo API hard drive health HP Microserver KVM Laravel larvel 5 lenovo Linux Minion mint netgear nas networking network shares php PHP development Postfix raspberry pi review samba security SMART smartctl smartmontools smb testing traefik ubuntu ubuntu 18.04 ubuntu 20.04 ubuntu 22.04 ubuntu server vagrant Virtual machines xdebug xubuntu

© Copyright 2015 apt get life