curl常用命令

it2024-05-11  47

curl常用命令行

发送请求,默认get方式

curl "url" //网页或json,string会打印到标准输出中,-o 参数可以制定输出位置

上传文件

curl -u name:password -T filePath ftp://serverName

使用代理

curl -x server:port url

保存cookie

curl -c cookie.txt url curl -D cookie.txrt url //保存header里的信息

使用cookie

curl -b cookie.txt url

模拟浏览器

curl -A "Mozilla/4.0(compatible; MSIE 8.0; Windows NT 5.0)" url

伪造referer

curl -e "www.baidu.com" url //会误以为从百度跳转过来的请求

下载文件

curl -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下载

curl -O -u name:password ftp://server

显示错误

curl -f url

指定post方式请求

curl url -X POST -d "name=user&age=18" curl url -X POST -d {"name":"user","age:18"}
最新回复(0)