yew6n-aaaaa-aaaad-qaqrq-cai.icp0.io Open in urlscan Pro
212.71.124.189  Public Scan

URL: https://yew6n-aaaaa-aaaad-qaqrq-cai.icp0.io/cURL/index.html
Submission: On December 13 via api from US — Scanned from GB

Form analysis 1 forms found in the DOM

Name: search

<form class="md-search__form" name="search">
  <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required="">
  <label class="md-search__icon md-icon" for="__search">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"></path>
    </svg>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"></path>
    </svg>
  </label>
  <nav class="md-search__options" aria-label="Search">
    <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
        <path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"></path>
      </svg>
    </button>
  </nav>
</form>

Text Content

Skip to content

notebook
cURL
Initializing search
GitHub
 * 185
 * 27

notebook
GitHub
 * 185
 * 27

 * Home
 * Python
   Python
    * Python
    * Gist Python一些常用代码片段
    * Course Python程序设计

 * Programming Languages
   Programming Languages
    * BASH
    * BAT批处理
    * C语言
    * Java
      Java
       * Java
       * S2-045
   
    * JavaScript
    * PHP

 * Web
   Web
    * CDN
    * cURL cURL
      Table of contents
       * 模拟浏览器请求
       * 基本教程
       * 还可以循环哟
       * wget在0b/s时自动重连
       * wget限制单文件最大大小
   
    * Favorites
      Favorites
       * Favorites
       * Github Project Recommendation
       * 更多链接
   
    * Flask
    * MySQL
    * Nginx
    * RabbitMQ

 * Development
   Development
    * Developer
    * Docker
    * ETH
    * Git
    * Jekyll
    * Paper Reading
    * WindowsSoftware

 * Fuzzing
   Fuzzing
    * DFSan

 * Fun
   Fun
    * Bitcoin

 * Linux
   Linux
    * Linux-backup
    * Linux-setup
    * Linux-SSH
    * Linux-cli
    * Linux-VirtualBox
    * Ubuntu

 * My Projects
   My Projects
    * ZJU grs helper
    * CCF Badge

Table of contents
 * 模拟浏览器请求
 * 基本教程
 * 还可以循环哟
 * wget在0b/s时自动重连
 * wget限制单文件最大大小


CURL¶

curl这么有用的东西,还是单独开个文档咯~



> 大名鼎鼎的cURL,不必多言;只是它的命令行的运行方式与libcurl用起来差异很大(如比较php的curl用法)
> 
> 官方:https://curl.haxx.se/
> 
> 简单入门:http://www.bathome.net/thread-1761-1-1.html
> 
> 将curl转为python requests http://curl.trillworks.com/

下载7.51 x64的Win版本

下载7.16 32bit的curl32.exe

--------------------------------------------------------------------------------


模拟浏览器请求¶

用Chrome开发人员工具,对请求右键,Copy as cURL就好啦

其中如果选择了cmd的版本,是不能用于写bat的,我的做法是复制成bash的版本用python循环之

--------------------------------------------------------------------------------


基本教程¶

REM 在bat中REM命令表示注释行

REM 简单的get一下
curl http://ip.cn

REM 保存到文件并断点续传(可以不指定文件名-O)
curl -o iplist.txt -c  http://f.ip.cn/rt/chnroutes.txt

REM POST请求,设置Referer,并使用代理
curl http://httpbin.org/post --data "something=somedata" -H "Referer: http://github.com/zjuchenyuan/" --proxy socks5://127.0.0.1:1080

REM 文件上传 @文件名
REM POST模式下的文件上的文件上传,比如
REM <form method="POST" enctype="multipart/form-data" action="http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi">
REM <input type=file name=upload>
REM <input type=submit name=nick value="go">
REM </form>
REM 这样一个HTTP表单,我们要用curl进行模拟,就该是这样的语法:
curl -F upload=@localfile -F nick=go http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi

REM 登录路由器
curl http://192.168.1.1 -u admin:admin

REM 存下Set-Cookie
curl -D cookie0001.txt http://www.yahoo.com

REM 使用存储的Cookie
curl -b cookie0001.txt http://www.yahoo.com

REM dict协议查字典,显示详细的请求信息
curl dict://www.dict.org/d:computer -v


--------------------------------------------------------------------------------


还可以循环哟¶

curl -OJ http://example.com/[1-100].jpg

curl -o “#1.html” http://www.example.com/page/[1-20]

--------------------------------------------------------------------------------


WGET在0B/S时自动重连¶

From:
https://askubuntu.com/questions/72663/how-to-make-wget-retry-download-if-speed-goes-below-certain-threshold

用法:

wget -c --tries=0 --read-timeout=20 [URL]


其中-c表示断点续传,–tries=0表示无限次重试,–read-timeout指定20s无网络活动就认为出错(默认是15分钟)

--------------------------------------------------------------------------------


WGET限制单文件最大大小¶

来源: https://yurichev.com/wget.html

可以下载到二进制直接用

增加了--limit-size参数,比如批量下载一个ftp链接:

wget --limit-size=10g --restrict-file-names=nocontrol -nH --tries=0 --read-timeout=20 -m ftp://xxx 


浙ICP备15043819号-2  浙公网安备 33010602007826号



Made with Material for MkDocs