Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install curl in Linux system

Shulou Source: shulou.com Published: 2022-06-01 20:38:53 10月02日 Update

This article mainly introduces how to install curl in the Linux system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Curl is a text transfer tool that uses URL syntax under the command line.

About curl: curl is a widely used command-line tool for uploading and downloading, but strictly speaking, it can also be used for other purposes. As far as testing is concerned, it is a very useful tool for Web-related testing, including debugging, and is very easy to use. On the other hand, because it is a pure command-line tool, it can also be easily integrated into automation or other testing frameworks as a component, giving it tasks such as uploading and downloading HTTP/HTTPS/FTP.

Linux system installation curl specific steps: get the installation package, download directly from the Internet or other channels, here directly wget

# wget http://curl.haxx.se/download/curl-7.17.1.tar.gz

Extract to the current directory

# tar-zxf curl-7.17.1.tar.gz

Enter the decompressed directory

# cd curl-7.17.1

Configuration, specify the installation directory, here is "/ usr/local/curl"

#. / configure-prefix=/usr/local/curl

# make

Installation

# make install

Installation completed

Use:

Add the curl command to the environment variable

Execute on the command line (only for local sessions, or configure environment variables in .bash _ profile, .bashrc files):

# export PATH=$PATH:/usr/local/curl/bin

And then you can use it.

# curl http://www.baidu.com

There is a lot of html code, which is the code of Baidu's home page.

Instructions for getting started:

Http://www.javaeye.com/topic/648143

Use an example (send a POST request):

# curl-d @ json http://www.google.com/loc/json

-d sends the request in the form of POST

@ json @ reads data from a file The contents in the json file are {"address_language": "zh_CN", "cell_towers": [{"cell_id": "36526", "location_area_code": "14556", "mobile_contry_code": "460", "mobile_network_code": "02"}], "host": "maps.google.com", "location": null, "request_address": true, "version": "1.1.0", "wifi_towers": []}

Return:

{"location": {"latitude": 32.117302, "longitude": 114.116598, "address": {"country": "China", "country_code": "CN", "region": "Henan Province", "city": "Xinyang City"}, "accuracy": 1625.0}, "access_token": "2:FaXK0Xl_DHRbcQiK:5tGTJsZx1scpjUfJ"}

Thank you for reading this article carefully. I hope the article "how to install curl in Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Commands tools articles systems files directories tests code variables environment configuration utility value tasks functions instructions interests content on the other hand at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Shulou Technology Microsoft Linux