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 / Technology / Guides / Run a Remote PHP Web Script from the Command Line with WGET

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:

1
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:

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

This runs the wget command at 6am every day.

Share this:

  • Twitter
  • Facebook
  • Reddit
  • Tumblr
  • Pinterest

Related

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

Recent Posts

  • Fixing Error Opening Spice Console SpiceClientGtk missing
  • Resetting a UniFi controller password
  • Optimising Nginx for PHP & WordPress (Time To First Byte)
  • Backing up email using offlineimap
  • Setup Fail2ban for NextCloud

Tags

7z 7zip API auditing BBC Courier MTA crochet data recovery debian debudding development Dingo API email Getting started with Laravel 5 & Dingo API hard drive health internet radio KVM Laravel larvel 5 lenovo Linux Mail Quota Minion mint netgear nas networking network shares php Postfix proxy server samba security SMART smartctl smartmontools smb smbfs testing ubuntu ubuntu 18.04 ubuntu server vagrant Virtual machines xdebug xubuntu

© Copyright 2015 apt get life