How to install curl

How to install curl

How to install curl

how to install curl and libcurl

Installing Binary Packages

Lots of people download binary distributions of curl and libcurl. This document does not describe how to install curl or libcurl using such a binary package. This document describes how to compile, build and install curl and libcurl from source code.

Building from git

If you get your code off a git repository instead of a release tarball, see the GIT-INFO file in the root directory for specific instructions on how to proceed.

A normal Unix installation is made in three or four steps (after you’ve unpacked the source archive):

You probably need to be root when doing the last command.

Get a full listing of all available configure options by invoking it like:

If you have write permission in that directory, you can do ‘make install’ without being root. An example of this would be to make a local install in your own home directory:

If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL ) and you have pkg-config installed, set the pkg-config path first, like this:

Without pkg-config installed, use this:

If you insist on forcing a build without SSL support, even though you may have OpenSSL installed in your system, you can run configure like this:

If you have OpenSSL installed, but with the libraries in one place and the header files somewhere else, you have to set the LDFLAGS and CPPFLAGS environment variables prior to running configure. Something like this should work:

If you have shared SSL libs installed in a directory where your run-time linker doesn’t find them (which usually causes configure failures), you can provide this option to gcc to set a hard-coded path to the run-time linker:

To force a static library compile, disable the shared library creation by running configure like:

To tell the configure script to skip searching for thread-safe functions, add an option like:

curl can be built to use a whole range of libraries to provide various useful services, and configure will try to auto-detect a decent default. But if you want to alter it, you can select how to deal with each individual library.

Select TLS backend

The default OpenSSL configure check will also detect and use BoringSSL or libressl.

Building Windows DLLs and C run-time (CRT) linkage issues

As a general rule, building a DLL with static CRT linkage is highly discouraged, and intermixing CRTs in the same app is something to avoid at any cost.

Reading and comprehending Microsoft Knowledge Base articles KB94248 and KB140584 is a must for any Windows developer. Especially important is full understanding if you are not going to follow the advice given above.

If your app is misbehaving in some strange way, or it is suffering from memory corruption, before asking for further help, please try first to rebuild every single library your app uses as well as your app using the debug multithreaded dynamic C runtime.

If you get linkage errors read section 5.7 of the FAQ document.

Make sure that MinGW32’s bin dir is in the search path, for example:

then run mingw32-make mingw32 in the root dir. There are other make targets available to build libcurl with more features, use:

If you have any problems linking libraries or finding header files, be sure to verify that the provided Makefile.m32 files use the proper paths, and adjust as necessary. It is also possible to override these paths with environment variables, for example:

It is also possible to build with other LDAP SDKs than MS LDAP; currently it is possible to build with native Win32 OpenLDAP, or with the Novell CLDAP SDK. If you want to use these you need to set these vars:

or for using the Novell SDK:

If you want to enable LDAPS support then set LDAPS=1.

Disabling Specific Protocols in Windows builds

The configure utility, unfortunately, is not available for the Windows environment, therefore, you cannot use the various disable-protocol options of the configure utility on this platform.

However, you can use the following defines to disable specific protocols:

If you want to set any of these defines you have the following options:

Using BSD-style lwIP instead of Winsock TCP/IP stack in Win32 builds

In order to compile libcurl and curl using BSD-style lwIP TCP/IP stack it is necessary to make definition of preprocessor symbol USE_LWIPSOCK visible to libcurl and curl compilation processes. To set this definition you have the following alternatives:

Once that libcurl has been built with BSD-style lwIP TCP/IP stack support, in order to use it with your program it is mandatory that your program includes lwIP header file (or another lwIP header that includes this) before including any libcurl header. Your program does not need the USE_LWIPSOCK preprocessor definition which is for libcurl internals only.

Compilation has been verified with lwIP 1.4.0 and contrib-1.4.0.

This BSD-style lwIP TCP/IP stack support must be considered experimental given that it has been verified that lwIP 1.4.0 still needs some polish, and libcurl might yet need some additional adjustment, caveat emptor.

Important static libcurl usage note

Legacy Windows and SSL

Schannel (from Windows SSPI), is the native SSL library in Windows. However, Schannel in Windows

Apple iOS and macOS

For macOS users: In OS X 10.8 («Mountain Lion»), Apple made a major overhaul to the Secure Transport API that, among other things, added support for the newer TLS 1.1 and 1.2 protocols. To get curl to support TLS 1.1 and 1.2, you must build curl on Mountain Lion or later, or by using the equivalent SDK. If you set the MACOSX_DEPLOYMENT_TARGET environmental variable to an earlier version of macOS prior to building curl, then curl will use the new Secure Transport API on Mountain Lion and later, and fall back on the older API when the same curl binary is executed on older cats. For example, running these commands in curl’s directory in the shell will build the code such that it will run on cats as old as OS X 10.6 («Snow Leopard») (using bash):

Download and unpack the curl package.

cd to the new directory. (e.g. cd curl-7.12.3 )

In some cases, you may be able to simplify the above commands to as little as:

Note that newer compilers often produce smaller code than older versions due to improved optimization.

The GNU compiler and linker have a number of options that can reduce the size of the libcurl dynamic libraries on some platforms even further. Specify them by providing appropriate CFLAGS and LDFLAGS variables on the configure command-line, e.g.

Using these techniques it is possible to create a basic HTTP-only shared libcurl library for i386 Linux platforms that is only 113 KiB in size, and an FTP-only library that is 113 KiB in size (as of libcurl version 7.50.3, using gcc 5.4.0).

You may find that statically linking libcurl to your application will result in a lower total size than dynamically linking.

This is a probably incomplete list of known hardware and operating systems that curl has been compiled for. If you know a system curl compiles and runs on, that isn’t listed, please let us know!

How to install curl

how to install curl and libcurl

Installing Binary Packages

Lots of people download binary distributions of curl and libcurl. This document does not describe how to install curl or libcurl using such a binary package. This document describes how to compile, build and install curl and libcurl from source code.

Building using vcpkg

You can download and install curl and libcurl using the vcpkg dependency manager:

The curl port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Building from git

If you get your code off a git repository instead of a release tarball, see the GIT-INFO file in the root directory for specific instructions on how to proceed.

A normal Unix installation is made in three or four steps (after you have unpacked the source archive):

(Adjust the configure line accordingly to use the TLS library you want.)

You probably need to be root when doing the last command.

Get a full listing of all available configure options by invoking it like:

If you have write permission in that directory, you can do ‘make install’ without being root. An example of this would be to make a local install in your own home directory:

If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL ) and you have pkg-config installed, set the pkg-config path first, like this:

Without pkg-config installed, use this:

If you insist on forcing a build without SSL support, even though you may have OpenSSL installed in your system, you can run configure like this:

If you have OpenSSL installed, but with the libraries in one place and the header files somewhere else, you have to set the LDFLAGS and CPPFLAGS environment variables prior to running configure. Something like this should work:

If you have shared SSL libs installed in a directory where your runtime linker does not find them (which usually causes configure failures), you can provide this option to gcc to set a hard-coded path to the runtime linker:

To force a static library compile, disable the shared library creation by running configure like:

To tell the configure script to skip searching for thread-safe functions, add an option like:

curl can be built to use a whole range of libraries to provide various useful services, and configure will try to auto-detect a decent default. But if you want to alter it, you can select how to deal with each individual library.

Select TLS backend

These options are provided to select the TLS backend to use.

Building Windows DLLs and C runtime (CRT) linkage issues

As a general rule, building a DLL with static CRT linkage is highly discouraged, and intermixing CRTs in the same app is something to avoid at any cost.

Reading and comprehending Microsoft Knowledge Base articles KB94248 and KB140584 is a must for any Windows developer. Especially important is full understanding if you are not going to follow the advice given above.

If your app is misbehaving in some strange way, or it is suffering from memory corruption, before asking for further help, please try first to rebuild every single library your app uses as well as your app using the debug multithreaded dynamic C runtime.

If you get linkage errors read section 5.7 of the FAQ document.

Make sure that MinGW32’s bin directory is in the search path, for example:

then run mingw32-make mingw32 in the root dir. There are other make targets available to build libcurl with more features, use:

If you have any problems linking libraries or finding header files, be sure to verify that the provided Makefile.m32 files use the proper paths, and adjust as necessary. It is also possible to override these paths with environment variables, for example:

It is also possible to build with other LDAP SDKs than MS LDAP; currently it is possible to build with native Win32 OpenLDAP, or with the Novell CLDAP SDK. If you want to use these you need to set these vars:

or for using the Novell SDK:

If you want to enable LDAPS support then set LDAPS=1.

Disabling Specific Protocols in Windows builds

The configure utility, unfortunately, is not available for the Windows environment, therefore, you cannot use the various disable-protocol options of the configure utility on this platform.

You can use specific defines to disable specific protocols and features. See CURL-DISABLE.md for the full list.

If you want to set any of these defines you have the following options:

Using BSD-style lwIP instead of Winsock TCP/IP stack in Win32 builds

In order to compile libcurl and curl using BSD-style lwIP TCP/IP stack it is necessary to make the definition of the preprocessor symbol USE_LWIPSOCK visible to libcurl and curl compilation processes. To set this definition you have the following alternatives:

Once that libcurl has been built with BSD-style lwIP TCP/IP stack support, in order to use it with your program it is mandatory that your program includes lwIP header file (or another lwIP header that includes this) before including any libcurl header. Your program does not need the USE_LWIPSOCK preprocessor definition which is for libcurl internals only.

Compilation has been verified with lwIP 1.4.0 and contrib-1.4.0.

This BSD-style lwIP TCP/IP stack support must be considered experimental given that it has been verified that lwIP 1.4.0 still needs some polish, and libcurl might yet need some additional adjustment, caveat emptor.

Important static libcurl usage note

Legacy Windows and SSL

Schannel (from Windows SSPI), is the native SSL library in Windows. However, Schannel in Windows

Apple Platforms (macOS, iOS, tvOS, watchOS, and their simulator counterparts)

Above will build curl for macOS platform with x86_64 architecture and 10.8 as deployment target.

Here is an example for iOS device:

Another example for watchOS simulator for macs with Apple Silicon:

In all above, the built libraries and executables can be found in the artifacts folder.

When building on Linux or targeting other API levels or architectures, you need to adjust those variables accordingly. After that you can build curl like this:

Note, however, that you must target at least Android M (API level 23) or configure will not be able to detect OpenSSL since stderr (and the like) were not defined before Android M.

For IBM i (formerly OS/400), you can use curl in two different ways:

There are some additional limitations and quirks with curl on this platform; they affect both environments.

By default, jobs in IBM i will not start with threading enabled. (Exceptions include interactive PASE sessions started by QP2TERM or SSH.) If you use curl in an environment without threading when options like async DNS were enabled, you will get messages like:

Do not panic. curl and your program are not broken. You can fix this by:

Download and unpack the curl package.

cd to the new directory. (e.g. cd curl-7.12.3 )

In some cases, you may be able to simplify the above commands to as little as:

Note that newer compilers often produce smaller code than older versions due to improved optimization.

The GNU compiler and linker have a number of options that can reduce the size of the libcurl dynamic libraries on some platforms even further. Specify them by providing appropriate CFLAGS and LDFLAGS variables on the configure command-line, e.g.

Using these techniques it is possible to create a basic HTTP-only libcurl shared library for i386 Linux platforms that is only 133 KiB in size (as of libcurl version 7.80.0, using gcc 11.2.0).

You may find that statically linking libcurl to your application will result in a lower total size than dynamically linking.

This is a probably incomplete list of known CPU architectures and operating systems that curl has been compiled for. If you know a system curl compiles and runs on, that is not listed, please let us know!

85 Operating Systems

AIX, AmigaOS, Android, Aros, BeOS, Blackberry 10, Blackberry Tablet OS, Cell OS, ChromeOS, Cisco IOS, Cygwin, Dragonfly BSD, eCOS, FreeBSD, FreeDOS, FreeRTOS, Fuchsia, Garmin OS, Genode, Haiku, HardenedBSD, HP-UX, Hurd, Illumos, Integrity, iOS, ipadOS, IRIX, LineageOS, Linux, Lua RTOS, Mac OS 9, macOS, Mbed, Micrium, MINIX, MorphOS, MPE/iX, MS-DOS, NCR MP-RAS, NetBSD, Netware, Nintendo Switch, NonStop OS, NuttX, OpenBSD, OpenStep, Orbis OS, OS/2, OS/400, OS21, Plan 9, PlayStation Portable, QNX, Qubes OS, ReactOS, Redox, RICS OS, Sailfish OS, SCO Unix, Serenity, SINIX-Z, Solaris, SunOS, Syllable OS, Symbian, Tizen, TPF, Tru64, tvOS, ucLinux, Ultrix, UNICOS, UnixWare, VMS, vxWorks, WebOS, Wii system software, Windows, Windows CE, Xbox System, z/OS, z/TPF, z/VM, z/VSE

22 CPU Architectures

Alpha, ARC, ARM, AVR32, Cell, HP-PA, Itanium, m68k, MicroBlaze, MIPS, Nios, OpenRISC, POWER, PowerPC, RISC-V, s390, SH4, SPARC, VAX, x86, x86-64, Xtensa

How to install cURL on windows and how to use it

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

This article describes how to install and use CURL on Windows. Curl is a free command line utility used for transferring files using various protocols. Most commonly it is used for transferring files over HTTP(S).

cURL comes natively installed on Unix based operating systems such as MacOS and Linux. But windows is left out. Now that we have PowerShell on windows, you can get some of the functionality of cURL using various cmdlets like invoke-webrequest. However, if you are used to using a Unix toolset, you will be left wondering where you can find cURL.

Methods of Installing cURL

To install cURL on windows, you have five real options:

In the next few sections, we will discuss each of the above installation methods.

Chocolatey Package Manager

If you want to go the Chocolatey route, it is really simple, just run:

This will install cURL for you. However, you need to first install the Chocolatey package manager. You can find instructions on how to install Chocolatey here.

Download Pre-Compiled cURL Binaries

cURL is supported on many platforms. And if you navigate here, you will see binaries you can download for many different platforms. All the way at the bottom of the page you will find the windows builds. They are all labeled as Win32 or Win64

I recommend you download the zip file in the Win64 – Generic section:

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

After you have downloaded and extracted the zip file, look in the src folder, you will find curl.exe. Copy curl.exe into your C:\windows\system32\ folder. I choose this folder because it includes all of the other system utilities. And it is already part of your PATH variable, so you don’t have to do anything to add it.

Compile from Source Code

This is the hardest method of installation. If you are trying to get things up quickly, you should skip over this section. But, for those who want to do it just for the experience, or those who absolutely need the latest version, building from source code might be the method for you. You can find instructions on how to install from source code here: https://curl.haxx.se/docs/install.html

Install CYGWIN

CYGWIN is a Unix-like environment for Windows. You can’t natively run all of your favorite Unix tools on Windows. First, you have to download the source code and compile it to run on windows. Just like in the previous section. CYGWIN is a project where someone has gone through the work to pre-compile many of your favorite Unix tools for you.

To use cURL as part of CYGWIN, you first download and CYGWIN installer from here. While you are going through the installer, you will encounter a list of packages you wish to install. Make sure you select the cURL package.

Install Windows Subsystem for Linux (WSL)

Starting with Windows 10, Microsoft has released a product called Windows Subsystem for Linux (WSL). WSL gives you the bash command shell on windows, which is the same shell that runs on Linux/Unix. Installing WSL gives you a full Linux environment, unlike CYGWIN which is simply a collection of Unix utilities. WSL is based on Ubuntu Linux. So you will have tools like apt-get to install programs etc…. The main limitation of WSL is you don’t have a GUI. But that is fine for our purposes today.

Older builds of Windows 10 will have to enable Developer mode before they can install the windows feature. You can find instructions on how to do that here.

Starting with the windows 10 Fall Creators update, you don’t have to enable Developer mode. However, it is still a two-step process. First, you enable the windows feature. Then you install the Linux distribution from the windows store. instructions can be found here.

After you have installed WSL, go to your Start menu, click on Bash, and you can use all of your favorite Linux tools, including cURL.

How to use cURL on Windows

As this guide is about installing cURL, I won’t go into great detail about using curl. However, here are some basics. Each of these commands will largely work the same way on both Windows and Unix variants.

First, you need to launch the appropriate command line environment. If you installed WSL or CYGWIN, you will need to go to your start menu and launch CYGWIN or BASH. Otherwise, you can launch a command prompt or Powershell window.

The above command will show you all the different command arguments you can pass to cURL. This will be very important as you are learning how to use the tool.

Lets try pulling down the text of a webpage using curl with the following command:

You should see all the HTML code from idkrtm.com scroll by…that means it is working.

How to download website headers with curl

Next, let’s just pull down the headers. This is useful for just checking if a web page is working. If you’re on Linux, OSX/MacOS, CYGWIN, or WSL, the command would be:

the output should be similar to this:

HTTP/1.1 200 OKDate: Mon, 12 Feb 2018 15:25:35 GMTServer: ApacheX-Powered-By: PHP/5.5.38Link: ; rel=”https://api.w.org/”, ; rel=shortlinkTransfer-Encoding: chunkedContent-Type: text/html; charset=UTF-8

On Windows Powershell, the same command would be:

Or on Windows CMD, the same command would be:

cURL Post request

When you make post requests, there are three kinds of posts you will probably make

In the next example, we will post a file to the same URL

You can see this is very similar to the previous two examples. However, we passed in JSON within the quotes, and we added a Content-Type:application/json header to the input. We did not have to do this in the previous examples, because the other examples were able to use the default content type: “Content-Type: application/x-www-form-urlencoded”

As you can imagine, the JSON you pass in can get quite large, so you can also pass in a JSON file

cURL Post request

As you are interacting with websites, it is only a matter of time before you encounter one where you need to authenticate. Similar to how you authenticate in your browser. cURL supports a variety of authentication methods, but today we will only cover basic authentication, which is very easy. See the example below.

Thank you for stopping by today. We discussed five different ways to install cURL on your windows computer. And some of the most common commands you might need to use with cURL.

As you can see, cURL is a very flexible tool that can work on both Windows and Unix variants of operating systems. If you want to know a lot more about cURL, there is a free book on GitHub, called Everything Curl, that goes into great detail about everything you want to know about cURL.

Installing and using cURL

All the examples in the Zendesk REST API docs use cURL, a lightweight, command-line tool for making HTTP requests without a web browser. cURL lets you try out various API requests in a command-line interface such as the command prompt in Windows or Terminal in macOS. You don’t need to build a working web application just to try out the APIs.

cURL makes HTTP requests just like a web browser. To request a web page from the command line, type curl followed by the site’s URL:

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

Disclaimer: Zendesk can’t provide support for third-party technologies such as cURL or Windows.

You can use cURL to inspect and test different Zendesk API requests without having to build a functioning web application. For example, the following cURL statement makes an HTTP request to the List Groups endpoint in the Zendesk API:

The API returns a JSON object that lists the groups in your Zendesk Support instance:

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It’s designed to be easy for humans to read and write, and for machines to parse and generate. To learn more, see Working with JSON.

Using cURL in Windows

You can use the Windows command prompt to run the cURL examples. To start the command prompt, open the Start menu, type cmd in the search box, and press Enter.

Note: If you use Windows, we recommend you use the Ubuntu terminal environment to run Bash commands. For setup steps, refer to Setting up a Windows development environment. If you use this option, ignore the instructions for Windows users in this article.

cURL isn’t installed in Windows by default. See Installing cURL below to install it on your system.

The examples in the docs have to be modified slightly to work correctly in Windows. First, replace any line-ending backslash (\) character with the caret (^) character. Second, if an example contains JSON data, move the data to a file before running the example. The following sections give more details.

Replace line-ending backslashes

The cURL examples often have a backslash (\) at the end of lines to break up a long statement into easier-to-read lines. The backslash is a line continuation character in UNIX but not in Windows. In Windows, replace any backslash at the end of lines with the caret (^) character, which is an escape character in Windows. Don’t leave any space after any ^ character or it won’t work. The caret will escape the space instead of the new line.

You can paste a multiline statement at the command prompt by clicking the icon in the upper-left corner and selecting Edit > Paste. If you prefer using the keyboard, press Alt+spacebar to open the menu, then press E and P.

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

Move JSON data to a file

The Windows command prompt doesn’t support single quotes. It’s a problem because cURL statements use single quotes to specify JSON data. Example:

To fix the problem, save the JSON in a separate file and import it into the cURL statement. To modify the example above, create a file named json.txt containing the following text:

Next, change the cURL statement to import the JSON data with the @filename syntax:

Before running the statement, use the cd command (for change directory) to navigate to the folder that contains the file. Example:

C:\> cd json_files

Then paste the cURL statement at the command prompt:

An alternative to moving the JSON to a separate file is to use double quotes around the JSON data in the cURL statement and escape the inner ones with backslashes:

This is tedious and error prone. Best to stick with importing the JSON from a file.

cURL is installed by default on macOS. To try it out, see Testing your cURL installation below.

Windows 10, version 1803 or later

If you have version 1803 or later of Windows 10, cURL is installed by default. To try it out, see Testing your cURL installation below.

If you have a version of Windows earlier than Windows 10, version 1803, you can download and install cURL as follows.

In Windows, create a folder called curl in your C: drive.

Go to http://curl.haxx.se/download.html and download one of the following zip files:

Unzip the downloaded file and move the curl.exe file to your C:\curl folder.

Go to http://curl.haxx.se/docs/caextract.html and download the digital certificate file named cacert.pem.

The PEM file contains a bundle of valid digital certificates. The certificates are used to verify the authenticity of secure websites. They’re distributed by certificate authority (CA) companies such as GlobalSign and VeriSign. The PEM file allows cURL to connect securely to the Zendesk API using the Secure Sockets Layer (SSL) protocol.

Move the cacert.pem file to your C:\curl folder and rename it curl-ca-bundle.crt.

Add the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt. Update the variable as follows:

In the Start menu, right-click This PC and select More > Properties.

Note: In Windows 7, right-click Computer and select Properties.

Click Advanced System Settings.

In the Advanced tab, click the Environment Variables button on the lower right side.

Select the «Path» variable in System Variables, and click Edit.

In the Edit environment variable dialog box, click New and add the path to the curl.exe file. Example: C:\curl.

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

Windows 7: In the Variable Value textbox, append a semicolon to the value, followed by the path to the curl.exe file. Example: ;C:\curl

Keep clicking OK to accept the change and close the dialog box.

Testing your cURL installation

You can test your cURL installation by making a request to the Zendesk API. The test retrieves your Zendesk Support user information.

To test cURL

Paste the following cURL statement into your favorite text editor:

For details on this endpoint, see Show the Currently Authenticated User in the Zendesk API docs.

Windows users: Replace the backslash (\) line continuation character with a caret (^) character. Make sure there’s no space after the caret. See Using cURL in Windows above.

Replace the placeholders in curly brackets with the information you use to sign in to Zendesk Support. Example:

Launch your command-line interface.

Copy the cURL statement from your text file and paste it at the command prompt.

Windows users: After copying it to the Clipboard, select Edit > Paste from the context menu in the upper left corner of the window:

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

Press Enter to run the cURL statement.

The console should display your Zendesk Support user information formatted as a JSON object.

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

You can pretty print the results to make it easier to read. See Converting JSON to data you can understand.

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

Common cURL flags

You’ll see the following cURL flags in the examples in the Zendesk REST API docs.

-H

Specifies any extra header content to include in the HTTP request. API requests that submit data to our servers typically include the data’s content type. Example:

-u

Specifies the user name and password to use for server authentication. The user name and password are separated by a colon.

-v

Makes the response more verbose.

-X

Specifies the request method to use when communicating with the HTTP server. Example: PUT or POST.

Note: GET is the default method so you don’t need to specify it.

For example, suppose you want to run the following search using the List Search Results endpoint:

Learn how to install & run cURL on Windows/MacOSX/Linux

How to install curl. Смотреть фото How to install curl. Смотреть картинку How to install curl. Картинка про How to install curl. Фото How to install curl

What is cURL?

cURL is a command-line tool that lets you transfer data to/from a server using various protocols. In this case, the curl command will establish a communication to POST or GET data to/from Ubidots Server over HTTP and HTTPS.

Below you will find the step-by-step to installing cURL in Windows, MacOSX and Linux.

Step-by-Step

1. Windows Installation

1. Enter and access the URL https://curl.haxx.se/ to download the curl executable wizard.

2. Select «curl executable» as Type of Package.

3. Then, on the «Select Operating System» section, select Windows. Then, continue selecting the parameters required based on your version of Windows.

4. Once you’ve finished the on-screen steps, download the zip file generated. To download it, simply press «Download«.

NOTE: To get a better understanding of the following steps, let’s assume the executable file is located inside a folder named «programs«.

6. From the Command Prompt, enter to the location where the executable file was pasted. To enter to the folder you need to use the cd command following the location of the folder which contains the executable file as you can see below.

Expected location to be shown

7. To verify if you are able to run curl commands with the command prompt, test functionality by executing the command below:

At this point, you should receive the all the help info related to the curl command.

[Troubleshooting] If you experience errors in the downloading process, please refer to this video for additional troubleshooting.

Now you are able to use cURL from your Windows pc!

2. MacOSX Installation

1. Enter to the computer’s terminal.

2. Run the command below in the terminal:

3. If a password is required after running the command, please enter your Mac’s user password to continue. Then, wait until the installation finish.

4. Run the command below in the terminal:

Now you are able to use cURL from your Mac pc!

3. Linux installation

1. Enter to the computer’s terminal.

2. Run the command below in the terminal:

3. If a password is required after ran the command, please enter your computers’ user password to continue. Then, wait until the installation finishes.

Now you are able to use cURL from your Linux pc!

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *