Introduction
curl is a powerful http command line tool under linux. Think of it as a command line browser.
Get page information
The following is the easiest way to get the HTML text of Baidu homepage.
curl http://www.baidu.com
If you want to get only the http request header, add the -I parameter
curl -I http://www.baidu.com
Form submission
get request form
curl "www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK"
post request form
curl -d "birthyear=1905&press=OK" www.hotmail.com/when/junk.cgi
Disguise browser
This instruction indicates that curl is disguised as IE5.0 and the user platform is Windows 2000. (The other party's server judges the type of client based on this string, so even if you use AIX, it doesn't matter.)
curl -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" URL
COOKIES
Cookies are a method of memorizing customer information that is often used by servers. If the cookie is recorded in the file, then use the command:
curl -b stored_cookies_in_file www.cookiesite. com
curl can write a new cookie based on the old cookie and send it to the website:
curl -b cookies.txt -c newcookies.txt www.cookiesite. com