search
HomeOperation and MaintenanceLinux Operation and MaintenanceDetailed explanation of curl command in linux

Usage details of the curl command in Linux: 1. [curl url] obtains the text information of the URL; 2. [curl -i url] obtains the text information and protocol header information of the URL; 3. [ curl -x proxy url】Use a proxy to obtain web page text information.

Detailed explanation of curl command in linux

Details of using the curl command in Linux:

1. curl url (get the URL Text information)

curl www.zhujy.com

This is the obtained www.zhujy.com information

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1 id="Welcome-nbsp-to-nbsp-nginx">Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

2, curl -i url (Get the text information and protocol header information of the URL)

This is the obtained text information and protocol header information of www.zhujy.com.

HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Mon, 11 Mar 2019 02:06:55 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 29 Oct 2018 09:52:22 GMT
Connection: keep-alive
ETag: "5bd6d856-264"
Accept-Ranges: bytes
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1 id="Welcome-nbsp-to-nbsp-nginx">Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

3. curl -x proxy url (use proxy to obtain web page text information)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>Test Page for the Nginx HTTP Server on Fedora</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <style type="text/css">
            /*<![CDATA[*/
            body {
                background-color: #fff;
                color: #000;
                font-size: 0.9em;
                font-family: sans-serif,helvetica;
                margin: 0;
                padding: 0;
            }
            :link {
                color: #c00;
            }
            :visited {
                color: #c00;
            }
            a:hover {
                color: #f50;
            }
            h1 {
                text-align: center;
                margin: 0;
                padding: 0.6em 2em 0.4em;
                background-color: #294172;
                color: #fff;
                font-weight: normal;
                font-size: 1.75em;
                border-bottom: 2px solid #000;
            }
            h1 strong {
                font-weight: bold;
                font-size: 1.5em;
            }
            h2 {
                text-align: center;
                background-color: #3C6EB4;
                font-size: 1.1em;
                font-weight: bold;
                color: #fff;
                margin: 0;
                padding: 0.5em;
                border-bottom: 2px solid #294172;
            }
            hr {
                display: none;
            }
            .content {
                padding: 1em 5em;
            }
            .alert {
                border: 2px solid #000;
            }
            img {
                border: 2px solid #fff;
                padding: 2px;
                margin: 2px;
            }
            a:hover img {
                border: 2px solid #294172;
            }
            .logos {
                margin: 1em;
                text-align: center;
            }
            /*]]>*/
        </style>
    </head>
    <body>
        <h1 id="Welcome-nbsp-to-nbsp-strong-nginx-strong-nbsp-on-nbsp-Fedora">Welcome to <strong>nginx</strong> on Fedora!</h1>
        <div>
            <p>This page is used to test the proper operation of the
            <strong>nginx</strong> HTTP server after it has been
            installed. If you can read this page, it means that the
            web server installed at this site is working
            properly.</p>
            <div>
                <h2 id="Website-nbsp-Administrator">Website Administrator</h2>
                <div>
                    <p>This is the default <tt>index.html</tt> page that
                    is distributed with <strong>nginx</strong> on
                    Fedora.  It is located in
                    <tt>/usr/share/nginx/html</tt>.</p>
                    <p>You should now put your content in a location of
                    your choice and edit the <tt>root</tt> configuration
                    directive in the <strong>nginx</strong>
                    configuration file
                    <tt>/etc/nginx/nginx.conf</tt>.</p>
                </div>
            </div>
            <div>
                <a href="http://nginx.net/"><img src="/static/imghwm/default1.png"  data-src="nginx-logo.png"  class="lazy" 
                     
                    alt="[ Powered by nginx ]"
                     style="max-width:90%" height="32" /></a>
                <a href="http://fedoraproject.org/"><img src="/static/imghwm/default1.png"  data-src="poweredby.png"  class="lazy"  
                     
                    alt="[ Powered by Fedora ]" 
                     style="max-width:90%" height="31" /></a>
            </div>
        </div>
    </body>
</html>

4. curl -X POST --header "Content-Type:application/json" --data '{}' url (use post to simulate json format request interface)

curl -X POST --header "Content-Type:application/json"  --data &#39;{}&#39;  127.0.0.1:8088/user/getAllUserInfo
{"resultCode":"0","resultMsg":"成功","data":{"userList":[{"id":"a6fc8f27-e598-11e8-ba67-00163e14685b","name":"tom","age":"18","address":"北京1","stage":"NBA"},{"id":"24793d7c-e199-11e8-ba67-00163e14685b","name":"tom","age":"18","address":"北京3","stage":"NBA"},{"id":"247acf89-e599-11e8-ba67-00163e14685b","name":"jerry","age":"18","address":"深圳22","stage":"NBA"},{"id":"247cdafc-e599-11e8-ba67-00163e14685b","name":"james","age":"38","address":"广州d4","stage":"NBA"},{"id":"247ed96c-e599-11e8-ba67-00163e14685b","name":"curry","age":"58","address":"上海fv","stage":"NBA"},{"id":"24805b4e-e599-11e8-ba67-00163e14685b","name":"kaven","age":"78","address":"陇县","stage":"NBA"},{"id":"2481f851-e599-11e8-ba67-00163e14685b","name":"durant","age":"68","address":"富平","stage":"NBA"}]}}

POST specifies the request method

– header specifies the request header information

–data specifies the json request body data content

5. curl -I url (only returns the request header information)

curl -I www.zhujy.com.cn
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Mon, 11 Mar 2019 03:34:29 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 29 Oct 2018 09:52:22 GMT
Connection: keep-alive
ETag: "5bd6d856-264"
Accept-Ranges: bytes

Related learning recommendations: linux video tutorial

The above is the detailed content of Detailed explanation of curl command in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What to do if the email sending of Debian mail server failsWhat to do if the email sending of Debian mail server failsApr 13, 2025 am 11:30 AM

When the Debian mail server mail sending fails, you can troubleshoot and resolve the following steps: Check the mail server configuration Check the configuration file: Carefully check the mail server configuration file, such as /etc/exim4/update-exim4.conf.conf to ensure that the settings are correct. DNS resolution: Confirm that DNS resolution is normal, you can test it through the telnetsmtp.qq.com25 command. Port Settings: Make sure that the SMTP port (usually 25) is open and not blocked by the firewall. Check the mail

Where is the Debian OpenSSL configuration fileWhere is the Debian OpenSSL configuration fileApr 13, 2025 am 11:27 AM

OpenSSL configuration files are usually located in /etc/ssl/openssl.cnf. This file contains the main configuration information of OpenSSL, such as the file path of the key and certificate, encryption algorithm options, etc. Please note that before modifying the configuration file, it is recommended to back up the original file in case configuration errors affect system security. If you need to learn more about how to edit or modify OpenSSL configuration files, you can refer to the relevant system administration manual or online tutorial. Also, when making any system-level changes, make sure you have sufficient permissions and be careful when doing it

What is the execution process of Debian HadoopWhat is the execution process of Debian HadoopApr 13, 2025 am 11:24 AM

The Hadoop task execution process mainly includes the following steps: Submit the job: the user uses the command line tools or API provided by Hadoop on the client machine to build the task execution environment and submit the task to YARN (Hadoop's resource manager). Resource application: After YARN receives the task submission request, it will apply for resources from the nodes in the cluster based on the resources required by the task (such as memory, CPU, etc.). Task Start: Once the resource allocation is completed, YARN will send the task's startup command to the corresponding node. On the node, NodeMana

How to ensure FetchDebian securityHow to ensure FetchDebian securityApr 13, 2025 am 11:21 AM

FetchDebian (usually refers to the process of obtaining software packages from a Debian repository through the APT package manager) does not directly provide security guarantees, but it relies on the security mechanism and update process of the Debian distribution body. Here are detailed instructions on how to ensure system security through FetchDebian: Debian's security update mechanism is regularly updated: Debian projects will regularly release security updates and patches to fix known security vulnerabilities and improve system stability. Users can automatically update the system through APT commands to ensure their software

How to implement Zookeeper data backup on DebianHow to implement Zookeeper data backup on DebianApr 13, 2025 am 11:18 AM

Implementing Zookeeper data backup on Debian can be done in the following ways: Manual backup stops the Zookeeper service: Before backing up the configuration, you need to stop the Zookeeper service to ensure data consistency. You can stop the Zookeeper service using the following command: sudosystemctlstopzookeeper copy configuration files and data directory: Zookeeper's configuration files are usually located in /etc/zookeeper/conf directory

How to generate a key pair in Debian OpenSSLHow to generate a key pair in Debian OpenSSLApr 13, 2025 am 11:15 AM

Generating key pairs using OpenSSL on Debian systems is very simple. Here are the steps to generate an RSA key pair: Open a terminal (Terminal). Enter the following command to generate a new private key: opensslgenrsa-outprivate_key.pem2048 Here, private_key.pem is the file name you want to save the private key, and 2048 represents the length of the key (in bits). You can choose different ones as needed

What are the key points for setting Debian Hadoop permissionsWhat are the key points for setting Debian Hadoop permissionsApr 13, 2025 am 11:12 AM

When setting Hadoop permissions on Debian, you need to consider the following key points: User and user group management: Create users and user groups for management in the cluster. Users and groupadd commands can be used to create users and user groups. Set the user's home directory and login shell, and use the usermod command to modify user information. File and directory permission settings: Use the ls-l command to view the permissions of files or directories. Use the chmod command to modify permissions, you can use digital modules

How to perform digital signature verification with Debian OpenSSLHow to perform digital signature verification with Debian OpenSSLApr 13, 2025 am 11:09 AM

Using OpenSSL for digital signature verification on Debian systems, you can follow these steps: Preparation to install OpenSSL: Make sure your Debian system has OpenSSL installed. If not installed, you can use the following command to install it: sudoaptupdatesudoaptininstallopenssl to obtain the public key: digital signature verification requires the signer's public key. Typically, the public key will be provided in the form of a file, such as public_key.pe

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools