• curl 使用笔记


     一、使用案例

    curl -H "cookie:userName=shangyy" www.baidu.com

    二、使用

    1、从Netscape的网页服务器上获得该网站的主页:

    curl http://www.netscape.com/

    2、从futnet的ftp服务器的用户主目录获得指定文件:README

    curl ftp://ftp.funet.fi/README

    3、使用服务器的8000端口获得web主页:

    curl http://www.weirdserver.com:8000/

    4、列出ftp站点目录中的文件:

    curl ftp://cool.haxx.se/

    5、从字典查询网站获得词条curl的定义:

    curl dict://dict.org/m:curl

    6、次性操作取得二份文档:

    curl ftp://cool.haxx.se/ http://www.weirdserver.com:8080/

    7、从FTPS服务器上获取文件:

    curl ftps//files.are.secure.com/secrets.txt

    或者使用推荐的方法访问FTPS服务器来执行相同的操作:

    curl --ftp-ssl  ftp//files.are.secure.com/secrets.txt

    8、使用SFTP从一个SSH服务器上获取一份文件:

    curl -u username sftp://example.com/etc/issue

    9、从一台使用私钥认证(私钥未使用密码保护)的SSH服务器上使用SCP获取一份文件:

    curl -u username: --key ~/.ssh/id_rsa 
    scp://example.com/~/file.txt

    10、从一台使用私钥认证(私钥使用密码保护)的SSH服务器上使用SCP获取一份文件:

    curl -u username: --key ~/.ssh/id_rsa --pass private_key_password 
    scp://example.com/~/file.txt

    11、从一台使用IPv6的网页服务器上获得站点主页:

    curl "http://[2001:1890:1112:1::20]/"

    12、从一台Samba文件服务器上获得文件:

    curl -u "domainusername:passwd" smb://server.example.com/share/file.txt
  • 相关阅读:
    [linux] ubuntu gnome 控制面板恢复
    [linux] grub修改
    [erlang] 合并list
    hdu4169 Wealthy Family (树形背包)
    hdu 3899 JLUCPC
    最大流模板
    hdu 4167 User Names
    hdu 2196 Computer (树形DP)
    hdu 1011 Starship Troopers(树形DP)
    hdu 2874 Connections between cities (LCA转RMQ)
  • 原文地址:https://www.cnblogs.com/shangyueyue/p/10855292.html
Copyright © 2020-2023  润新知