28 examples for curl

{{ score }}
  # get the contents of a web page
curl http://bropages.org
        
{{ score }}
  # download a file and write it to another file called myfile.html
curl -o myfile.html http://bropages.org
        
{{ score }}
  # Download a file using its original filename, follow all redirects, and continue where you left off if the download previously failed
curl -LOC - http://foo.bar/file.ext
        
{{ score }}
  # send a header with curl
curl --header "X-BeerIsInteresting: 1" www.bropages.org
        
{{ score }}
  curl -I http://google.com
gets the headers for a given page
        
{{ score }}
  # Get my external IP address 
curl ifconfig.me/ip

# Get my remote host
curl ifconfig.me/host

# Get my user agent
curl ifconfig.me/ua

# Get port
curl ifconfig.me/port
        
{{ score }}
  # POST request
curl --data "param1=value1¶m2=value2" http://www.bropages.com
        
{{ score }}
  # Post a file to a shiny enterprise webservice api
curl -d @invoice.pdf -X POST http://devnull-as-a-service.com/dev/null
        
{{ score }}
  # POST the JSON encoded object
# {
#         "command": "sup",
#             "chill": true
# }
# with header 'X-BRO-HEADER' and value 91384934 to api.bro.com
curl -X POST api.bro.com -d '{"command": "sup", "chill": true}' -H "X-BRO-HEADER: 91384934"
        
{{ score }}
  # Get the header of a page. Very handy for checking HTTP status, such as redirects. Also, check out httpstatus.es as a quick reference.
curl -I http://somapage.com
        
{{ score }}
  # POST the contents of a file (data.json in this example)
curl -X POST -d @data.json http://httpbin.org/post
        
{{ score }}
  # Curl without progress bar, so you can pipe output
curl -s http://path.to/resource | less
curl -s http://path.to/resource | vim --
        
{{ score }}
  # get public ip address using curl
curl ipecho.net/plain ; echo
        
{{ score }}
  # Use curl and ignore certificate errors
curl --insecure http://my.homespun.website.com
        
{{ score }}
  # Update Twitter
curl -u user:pass -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
        
{{ score }}
  # Check Gmail
curl -u username --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'
        
{{ score }}
  # Get the response time with cURL 
curl -o /dev/null -s -w %{time_total}\\n  http://www.google.com
        
{{ score }}
  # POST a raw binary file with absolutely no extra processing
curl --data-binary @"image.png" http://an.imageprocessor.com
        
{{ score }}
  # Run a curl and output the response headers to STDOUT
curl -D - http://www.google.com -s -o /dev/null
        
{{ score }}
  # post form data as application/x-www-form-urlencoded (through the use of -d flag)
curl -X POST -d "key1=val1&key2=val2" URL
        
{{ score }}
  # Read the headers of a request without submitting a HEAD request 
curl -sv "http://bropages.org" 1>/dev/null
        
{{ score }}
  # Send a header with curl and follow the bropages redirect
curl --header "X-BeerIsInteresting: 1" www.bropages.org -L
        
{{ score }}
  # download filename.ext and automatically name it as filename.ext on disk
curl -O http://domain.test/filename.ext
        
{{ score }}
  # get the contents of a web page
curl http://bropages.org
        
{{ score }}
  # your_comment_here
this is a test
        
{{ score }}
  # your_comment_here
man curl
        
{{ score }}
  # Download http://test.com/file.txt and print it to stdout. 
curl -o - http://test.com/file.txt
        
{{ score }}
  # your_comment_here
curl
ls
git
wget
dd
du
cal
ln
link