• Linux网站常用命令


    curl访问网站操作

    curl 是常用的命令行工具,用来请求 Web 服务器。它的名字就是客户端(client)的 URL 工具的意思。

    它的功能非常强大,命令行参数多达几十种。如果熟练的话,完全可以取代 Postman 这一类的图形界面工具。

    1.不带任何参数请求,就是GET请求

    $ curl https://www.example.com
    
    • 1

    2.-A参数,指定代理标头

    User-agent相当于身份标识,代表浏览器标识,网络爬虫默认的用户标头为:Python-urllib/3.6
    这样我们进行爬虫,我们浏览器可以对其禁止就好,我们可以改成浏览器的标头借身份证

    下面命令会移除访问google的代理表头,为空

    $ curl -A '' https://google.com
    
    • 1

    3.-H参数指定标头

    $ curl -H 'User-Agent: php/1.0' https://google.com
    
    • 1

    4.-b参数向服务器发送Cookie

    $ curl -b 'foo=bar' https://google.com
    $ curl -b cookies.txt https://www.google.com
    
    • 1
    • 2

    5.-c参数读取文件,并将服务器响应的呢容写道文件中

    $ curl -c cookies.txt https://www.google.com
    
    • 1

    6.-d参数用户发送POST请求体的数据体

    $ curl -d'login=emma&password=123'-X POST https://google.com/login
    # 或者
    $ curl -d 'login=emma' -d 'password=123' -X POST  https://google.com/login
    
    • 1
    • 2
    • 3

    7.-H参数添加HTTP标头

    $ curl -H 'Accept-Language: en-US' -H 'Secret-Message: xyzzy' https://google.com
    $ curl -d '{"login": "emma", "pass": "123"}' -H 'Content-Type: application/json' https://google.com/login
    
    • 1
    • 2

    8.-o参数将服务器的响应保存为文件,类似于wget命令

    $ curl -o example.html https://www.example.com
    
    • 1

    9.-k参数跳过SSL检测

    $ curl -k https://www.example.com
    
    • 1

    wget下载网站信息

    wget -b https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
    2 继续在后台运行,pid 为 1463
    • 1
    • 2
  • 相关阅读:
    Gartner发布《2022年中国ICT技术成熟度曲线》,明道云入选样本厂商
    文件上传—WAF拦截的绕过方式
    Java程序设计——类加载(Java高级应用)
    三西格玛和六西格玛区别是什么?优思学院用一幅图告诉你
    【Java|golang】210. 课程表 II---拓扑排序
    SpringMVC
    ISIS对IPv6的支持
    TypeScript又出新关键字了?
    Flutter循序渐进==>既要又要的异步技术
    CSS - 弹性布局(flex)
  • 原文地址:https://blog.csdn.net/weixin_57128596/article/details/127925325