curl常用命令
文章目录
【注意】最后更新于 May 7, 2020,文中内容可能已过时,请谨慎使用。
curl常用命令行
-
发送请求,默认
get方式1curl "url" //网页或json,string会打印到标准输出中,-o 参数可以制定输出位置
-
上传文件
1curl -u name:password -T filePath ftp://serverName -
使用代理
1curl -x server:port url -
保存
cookie1 2curl -c cookie.txt url curl -D cookie.txrt url //保存header里的信息 -
使用
cookie1curl -b cookie.txt url -
模拟浏览器
1curl -A "Mozilla/4.0(compatible; MSIE 8.0; Windows NT 5.0)" url -
伪造
referer1curl -e "www.baidu.com" url //会误以为从百度跳转过来的请求 -
下载文件
1 2 3 4curl -o tieba1.jpg http:www.baidu.com/tieba1.JPG curl -O http://www.baidu.com/tieba1.JPG curl -O http://www.baidu.com/tieba[1-5].JPG //循环下载 -
通过
ftp下载1curl -O -u name:password ftp://server -
显示错误
1curl -f url -
指定
post方式请求1 2curl url -X POST -d "name=user&age=18" curl url -X POST -d {"name":"user","age:18"}
个人内容记录