每天学习一点点。。。。

  • 直接获取页面数据:
curl http://www.xxx.com/[可以指定具体的路径获取某个文件]

用户名(密码):

curl -u username http://www.xxx.com
curl -u username:pwsswd http://www.xxx.com
curl http://name:passwd@xxx.domain/filepath/

下载页面数据:

#以`demo.html`文件保存
curl -o demo.html http://www.xxx.com/
  • 下载某个页面数据保存到本地并以源页面名称为默认命名(可以指定多个页面):
curl -O http://www.xxx.com/index.html/. [-O http://www.xxx2.com/html/]
  • 代理
curl -x proxy:port http://www.xxx.com/
#如果代理需要名字和密码,用-U指定(-u)指定页面需要的用户名密码
curl -U user:passwd -x proxy:port http://www.xxx.com/
  • 获取部分数据
#获取前100比特数据
curl -r 0-99 http://www.xxx.com/
#获取最后100比特数据
curl -r -100 http://www.xxx.com/

上传文件

#上传所有文件或者是从输入上传
curl -T - ftp://ftp.upload.com/myfile
#上传文件到远程服务器并使用本地文件名
curl -T uploadfile ftp://ftp.upload.com/
#上传文件并添加到远程文件中
curl -T uploadfile -a ftp://ftp.upload.com/

打印日志信息

curl -v http://www.xxx.com
#获取更多信息
curl --trace http://www.xxx.com

POST方法

curl -d "name=value&name1=value1" http://www.xxx.com/
-F 从文件中读取
curl -F "coolfiles=@fill.gif;type=image/gif,fil2.txt,fil3.html" http://www.xxx.com/
curl -F ”file=@coottext.txt“ -F "name=value" -F "name=value1 value2 ..." htttp://www.xxx.com/
curl -F "pict=@dog.gif,cat.gif" http://www.xxx.com/

Agent

curl -A 'Mozilla/3.0 (Win95; I)' http://www.xxx.com/

Cookies

curl -b "name=value" http://www.xxx.com
curl -c cookies.txt http://www.xxx.com
#read write
curl -b cookies.txt -c cookies.txt http://www.xxx.com

额外的头部信息

curl -H "X-you-and-me: yes" http://www.xxx.com

FTP 防火墙

#使用192.168.0.10作为IP地址
curl -P 192.168.0.10 ftp.download.com

HTTPS

curl -E /path/to/cert.pem:password https://www.xxx.com

文件续传

#download
curl -C - -o file ftp://ftp.server.com/path/file
#upload
curl -C - -T file ftp://ftp.server.com/path/file

-L

如果页面内容移动到另一个页面比如返回状态码30X,则向新的页面发送请求

-s

静默模式,没有输出

-S

当使用-s时,输出错误信息。

CURL命令学习一的更多相关文章

  1. curl命令学习(转载的)

    原文地址: http://www.thegeekstuff.com/2012/04/curl-examples/ curl是网络上常用一个命令,简单来说就是可以上传下载,甚至可以当成下载工具使用,比如 ...

  2. curl命令学习笔记

    下载文件并保存为默认文件名 curl -O http://www.xxx.com/xxx.exe 下载文件并保存为指定文件名 curl -o filename.exe http://www.xxx.c ...

  3. CURL命令学习三

    -I 只获取请求头 -k --insecure 每次SSL连接curl都需要验证是否安全.-k参数表示如果不安全也可以继续操作. -4 --ipv4 告诉curl只使用ipv4地址 -6 --ipv6 ...

  4. CURL命令学习二

    -a, --append 用于上传文件时,如果服务器上该文件不存在则创建,如果存在则追加到源文件. -K, --config <file> 指定从某个文件读取curl参数.如果指定-为文件 ...

  5. curl命令学习之一--基本用法

  6. linux命令学习之:curl

    curl命令是一个利用URL规则在命令行下工作的开源文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称curl为下载工具.作为一款强力工具,curl支持包括HTTP.HTTPS ...

  7. 【shell学习笔记】curl命令总结

    2014-12-16 20:34 文思海辉 =========== CURL命令总结 1. 下载 curl -o [文件名称] www.baidu.com 2. 显示 HTTP request头信息 ...

  8. 学习笔记之 curl 命令用法详解

    [前言]     本文翻译和整理自 Linux-2.6.32 中和 curl 相关的 Manual Page 描述文档. 文档目的仅在提醒读者所遗忘的知识点,故在整理时削弱了阅读流畅性,适用于对 cu ...

  9. [Shell学习笔记] 命令行下的高级网络工具cURL命令

    原文: http://www.1987.name/365.html Linux curl命令是一个利用URL规则在命令行下工作的文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯 ...

随机推荐

  1. jquery树形结构

    <div class="tree_content"> <div class="tree_node"> <div class=&qu ...

  2. 前端常用得CSS代码分享

    前端常用得CSS代码分享 本文首发于公众号:小夭同学,同步更新个人博客:故事影片,转载请署名.代码不断更新中!! 1,垂直居中对齐 .vc { position: absolute; top: 50% ...

  3. luogu P2947 [USACO09MAR]向右看齐Look Up |单调队列

    题目描述 Farmer John's N (1 <= N <= 100,000) cows, conveniently numbered 1..N, are once again stan ...

  4. 在phpstudy集成环境下的nginx服务器下配置url重写

    直接在对应的vhosts.conf配置文件的location / {}中添加以下内容: location / { index index.html index.htm index.php; #auto ...

  5. 制作通用framework的几点注意

    一.创建framework,调成静态的framework . 二.匹配bitcode 三.增加-ObjC 在BuildSettting ->Linking->Other Linker Fl ...

  6. iOS开发经常用到的国外网站,让我们接轨国外的最新技术吧!

    转自:http://www.bubuko.com/infodetail-787949.html 工欲善其事必先利其器,最近发现临时查找一些东西容易浪费时间,花了点时间整理一下常用的网站,方便以后备用. ...

  7. [TimLinux] PyQt5 安装部署

    1. 依赖包 Click (7.0) PyQt5 (5.11.2) PyQt5-sip (4.19.12) QScintilla (2.10.7) pip (9.0.1) pyqt5-tools (5 ...

  8. CSU-2018

    The gaming company Sandstorm is developing an online two player game. You have been asked to impleme ...

  9. mui 顶部选项卡的两种切换方式

    mui 顶部选项卡的两种切换方式 第一种main页面 <!DOCTYPE html> <html> <head> <meta charset="ut ...

  10. 基于 HTML5 + WebGL 的 3D 太阳系系统

    前言 近年来随着引力波的发现.黑洞照片的拍摄.火星上存在水的证据发现等科学上的突破,以及文学影视作品中诸如<三体>.<流浪地球>.<星际穿越>等的传播普及,宇宙空间 ...