Controlling from the command line --------------------------------- .. highlight:: console Using curl ^^^^^^^^^^ .. index:: curl `Curl <http://curl.haxx.se/>`_ is a popular tool for fetching web pages that is available on a huge range of platforms. To query the state of a device using curl:: # curl -u 'admin:555-0001' http://192.168.0.101/ <html><head><title>Juiceboss unit 555-0001</title> </head> <h1>Juiceboss unit 555-0001</h1> <p>Switch: 0<form action="/1" method="post"><INPUT type="submit" value="Turn on"></form> </p> <p>Voltage: 7.8</p> <p>Uptime: 3</p> <p>Firmware version: 501 2010/06/10</p> <hr> <p>This is the local page for Juiceboss unit 555-0001. You can control this unit from anywhere, and add useful features, at <a href="http://juiceboss.com/555-0001">http://juiceboss.com/555-0001</a></p> </html> To turn the switch off:: # curl -u 'admin:555-0001' -d '' http://192.168.0.101/0 and on:: # curl -u 'admin:555-0001' -d '' http://192.168.0.101/1 Using wget ^^^^^^^^^^ .. index:: wget `Wget <http://www.gnu.org/software/wget/>`_ is a free software package for retrieving files. To get the status of the device:: # wget -q -O - --http-user=admin --http-password=555-0001 http://192.168.0.101/ To turn the switch off:: # wget -q -O - --http-user=admin --http-password=555-0001 --post-data='' http://192.168.0.101/0 To turn it on:: # wget -q -O - --http-user=admin --http-password=555-0001 --post-data='' http://192.168.0.101/1