每天学习一点点。。。。

  • 直接获取页面数据:
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时,输出错误信息。

最新文章

  1. cf 710E dp
  2. 关于.Net Remoting 和 Web Servcie的比较
  3. C语言初学者代码中的常见错误与瑕疵(3)
  4. 收藏一些python的小技能
  5. Windows系统下Oracle数据库冷备
  6. Anniversary Party
  7. Sql Xtype
  8. Apache 实现ProxyPass转发URL到Tomcat并实现http自动转https【转载】
  9. JAVA基础---编码解码
  10. effective_java第23条:请不要新代码中使用原生态类型
  11. 为什么在python中推荐使用多进程而不是多线程(转载)
  12. db2pd工具
  13. 牛客网Wannafly挑战赛25A 因子 数论
  14. Struct2中自定义的Filter无效
  15. java根据地址获取百度API经纬度
  16. JSTL的比较运算符有哪些,用例说说它们的作用
  17. Yii2-设置和获取、删除Cookies空值分析(有代码)
  18. [LOJ#6198]谢特[后缀数组+trie+并查集]
  19. UVA.11427.Expect the Expected(期望)
  20. CRM总结

热门文章

  1. auto_modify_ip Shell脚本安装
  2. 发送json给服务器
  3. Idea工具Debug快捷键
  4. 基于servlet+filter+反射模拟实现天猫首页的后端
  5. Android多线程之(一)——View.post()篇
  6. JetBrains 迷你地图插件 CodeGlance
  7. python数据挖掘第一篇:正则表达式
  8. 常见的linux快捷方式和英文错误提示
  9. 回归损失函数2 : HUber loss,Log Cosh Loss,以及 Quantile Loss
  10. 垂直方向margin重叠原因与解决方法