一、使用案例

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 "domain\username:passwd" smb://server.example.com/share/file.txt

curl 使用笔记的更多相关文章

  1. cURL 学习笔记与总结(5)用 cURL 访问 HTTPS 资源

    <?php $curlobj = curl_init(); // 初始化 curl_setopt($curlobj, CURLOPT_URL, "https://ajax.aspnet ...

  2. cURL 学习笔记与总结(4)使用 cURL 从 ftp 上下载文件与上传文件到 ftp

    下载: <?php $curlobj = curl_init(); curl_setopt($curlobj, CURLOPT_URL, "ftp://192.***.*.***/文件 ...

  3. cURL 学习笔记与总结(2)网页爬虫、天气预报

    例1.一个简单的 curl 获取百度 html 的爬虫程序(crawler): spider.php <?php /* 获取百度html的简单网页爬虫 */ $curl = curl_init( ...

  4. cURL 学习笔记与总结(1)概念

    概念: cURL(Client URL Library Functions)is a command line tool for transfering data with URL syntax(使用 ...

  5. lua cURL使用笔记

    cURL cURL是 URL命令行工具, 即 command URL, 可以通过命令行模拟各种应用协议的发包, 包括FTP HTTP HTTPS, 官方网站 http://curl.haxx.se/ ...

  6. curl学习笔记(以php为例)

    一.demo,抓取百度页码代码: $url = 'https://www.baidu.com/'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RE ...

  7. python Eve RESTFul 尝试笔记

    0.前言 最近重点研究了yeelink平台的原理和使用,yeelink平台和多数云平台设计一样应用了RESTFul框架.嵌入式侧(或者是客服端侧)的相关技术研究的比较充分(个人这么认为),是不是该弄弄 ...

  8. linux下c/c++方式访问curl的帮助手册

    自:http://blog.chinaunix.net/u1/47395/showart_1768832.html 有个业务需求需要通过curl 代理的方式来访问外网 百度了一把,测试可以正常使用.记 ...

  9. 笔记整理--LibCurl开发

    LibCurl开发_未了的雨_百度空间 - Google Chrome (2013/7/26 21:11:15) LibCurl开发 一:LibCurl 编程流程1.调用curl_global_ini ...

随机推荐

  1. Android Stdio部分配置

    一.Error:Cause: unable to find valid certification path to requested target主要是在根目录的build.gradle下配置的jc ...

  2. Xshell连接阿里云服务被拒绝

    问题描述:突然的Xshell连接阿里云服务被拒绝了(如图)网上众多的方案都不行例如:https://www.cnblogs.com/wanglle/p/11416987.html(参考博文,本人这个问 ...

  3. CentOS下安装好python和opencv,却import cv2失败

    在安装好CentOS和OpenCV后,在终端输入python,在输入import cv2.却报错:ImportError:Mo module named cv2.浏览Python下文件夹发现cv2.s ...

  4. 图像处理---《在图片上打印文字 windows+GDI+TrueType字体》

    图像处理---<在图片上打印文字  windows+GDI+TrueType字体> 刚开始使用的是putText()函数做,缺陷是只能显示非中文: 接着,看大多数推荐Freetype库来做 ...

  5. F - Star SPOJ - STARSBC

    Fernando won a compass for his birthday, and now his favorite hobby is drawing stars: first, he marks ...

  6. 2018 牛客网暑期ACM多校训练营(第一场) E Removal (DP)

    Removal 链接:https://ac.nowcoder.com/acm/contest/139/E来源:牛客网 题目描述 Bobo has a sequence of integers s1, ...

  7. Introduction to Go Modules

    转:https://roberto.selbach.ca/intro-to-go-modules/ git init git add * git commit -am "First comm ...

  8. string::capacity string::size string::length string::max_size

    size_t capacity() const noexcept; #include <iostream>#include <string> using namespace s ...

  9. Ajax fileUpload

    在项目开发中用到ajax 的 fileUpload,遇到onchange事件只触发一次 原因是fileUpload调用后将原有的file元素改变了,需要早upload后重新绑定元素 第一次绑定: $( ...

  10. fwrite() and UTF8 转载

    4 down vote If you know the data is in UTF8 than you want to set up the header. I wrote a solution a ...