zoukankan      html  css  js  c++  java
  • Curl命令

    简单的请求

    curl "http://www.baidu.com"

    输出回复头

    curl -I "http://www.baidu.com"

    显示全部信息

    curl -i "http://www.baidu.com"

    Post请求

    curl -d "param1=value1&param2=value2" "http://www.baidu.com"

    json格式的post请求

    curl -l -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' http://domain/apis/users.json

     -H    自定义头部

     -X    使用指定的请求方式

    下载文件

    curl -O http://man.linuxde.net/text.iso
    curl -o dd.iso http://man.linuxde.net/text.iso

    不显示下载进度

    curl -O http://man.linuxde.net/text.iso --silent

    断点续传

    curl -O http://man.linuxde.net/text.iso --silent -C*****

    指定来源页

    curl --referer http://www.google.com http://man.linuxde.net

    设置cookies

    curl URL --cookie "user=root;pass=123456"

    导入cookies文件

    curl URL  --cookie-jar cookie_file

    设置用户代理

    curl URL --user-agent "Mozilla/5.0"
    curl URL -A "Mozilla/5.0"

    发送多个头部信息

    curl -H "Host:man.linuxde.net" -H "accept-language:zh-cn" URL

    登陆认证用户

    curl -u user:pwd http://man.linuxde.net #指定密码
    curl -u user http://man.linuxde.net   #不指定密码

    仅输出响应头

    curl -I http:// man.linuxde.net
    curl -head http://man.linuxde.net
  • 相关阅读:
    CF1202F You Are Given Some Letters...
    CF1178E Archaeology
    PTA (Advanced Level) 1005 Spell It Right
    PTA (Advanced Level) 1004 Counting Leaves
    Qt5——从零开始的Hello World教程(Qt Creator)
    PTA (Advanced Level) 1003 Emergency
    PTA (Advanced Level) 1002 A+B for Polynomials
    HDU 1272 小希的迷宫
    FZU 2150 Fire Game
    HihoCoder
  • 原文地址:https://www.cnblogs.com/demonxian3/p/7681613.html
Copyright © 2011-2022 走看看