# commandline foo API
cuel "http://www.commandlinefu.com/commands/<command-set>/<format>/"
curl "http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext"

esaminare le headers:

curl -I www.google.com
curl --head http://www.google.com

riprudurre un POST:

curl -v --data-ascii var=value http://test.com
# -d --data
curl -d "name=Rafael%20Sagula&phone=3320780" http://test.com/rpc
 
# multiple fileds encoded
curl \
    -d "method=Say.Hello" \
    -d "request={\"name\": \"John\"}" \
    http://localhost:8080/rpc

settando il tipo di risposta XML / JSON

curl -X POST -d @filename http://test.com/path/to/resource --header "Content-Type:text/xml"
curl -X POST -d @filename http://test.com/path/to/resource --header "Content-Type:application/json"
curl -X POST \
  https://localhost:8080/api/ff/xx \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{ "name":"zzzz" }'

scaricare un file

curl -o /tmp/logo.jpg 'http://test.com/logo.jpg'

FTP: scaricare un file

curl -o mytest ftp://user:password@test.com/library/mytest

UPLOAD di un file:

curl -i -F varname=value -F filedata=@filepath.jpg http://test.com/dir

login:

curl -d "username=<usr>&password=<pass>&submit=Login" --dump-header headers http://localhost/test
curl -L -b headers http://localhost/

uploading files to password protected service **

curl -X POST \
     -u USERNAME:PASSWORD     \
     -o transcript.json        \
     --header "Content-Type: audio/wav"    \
     --header "Transfer-Encoding: chunked" \
     --data-binary "@bb4TxjvQlh0.wav"        \
     "https://test.com/test"

wget

scaricare nonostante robots.txt

wget --debug
wget -r -e robots=off --wait 0.25 -U "Mozilla/5.0 (compatible; Konqueror/3.2; Linux)"  http://test.com/test/WB042R743/
# Download an entire website
wget --random-wait ---e robots=off -U mozilla http://www.test.com

mirror completo di una singola pagina compresi css, immagini e tutto il necessario per mostrare la pagina

wget -l 1 -v -k -p -E http://test.com/test