Find file
Fetching contributors…
Cannot retrieve contributors at this time
84 lines (38 sloc) 1.98 KB
curl: |-
curl - transfer a URL
curl [options] [URL...]
Command line internet/network loader tool and ajax test tool. Read the contents of a URL, dump the results to the stdout.
To return the entire page to stdout:
To simulate wget by downloading a file at a specific web address, use the -O flag:
curl -O
To see if a site is alive, just get the headers (--head or -I):
curl --head
A live response returns status, cookies, content length, etc.
To send custom headers (anything you want!) use (--header or -H):
curl --header "User-Agent: something-special"
curl -H "Accept-Encoding: gzip, deflate"
To retrieve data with POST:
curl -d "name1=a;name"
To simulate a form post:
curl -F "variable=value;variable2=value2" http://localhost:3000/your/url
This is helpful to get specific javascript back:
curl -H "Accept: application/json" -i -X GET http://localhost:3000/projects/3
Delete via rest (or set other http methods with the -X flag):
curl -X DELETE http://localhost:3000/projects/1
Authenticate with username and password (http-basic if not specified otherwise):
curl -u user:password
Save cookies to a file:
curl -c cookies.txt \
-F "username=meepo" -F "password=curiass" \
... and pass the saved cookies back to the server:
curl -b cookies.txt
Alternatively you can pass in cookies as key value pairs:
curl -b key=value
Or using the custom header option:
curl -H 'Cookie: key=value'
The view the man page: curl --manual | less
Related programs: wget