본문 바로가기

work/etc.

How do I install and use cURL on a Windows machine? (Windows cURL 설치)

출처 : http://guides.instructure.com/s/2204/m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine


Install cURL on Windows

There are 4 steps to follow to get cURL installed on Windows. There are two (2) libraries to install and they must be installed before cURL will work with SSL. Also, they must be installed in this order to workDo not skip step 4.

  • Step 1 and Step 2 is to install SSL library
  • Step 3 is to install cURL
  • Step 4 is to install a recent certificate

Step One: Install Visual C++ 2008 Redistributables

From http://www.shininglightpro.com/products/Win32OpenSSL.html

For 64bit systems

  • Visual C++ 2008 Redistributables (x64)

For 32bit systems

  • Visual C++ 2008 Redistributables (x32)

Step Two: Install Win(32/64) OpenSSL v1.0.0k Light

Also from http://www.shininglightpro.com/products/Win32OpenSSL.html

For 64bit systems

  • Win64 OpenSSL v1.0.0k Light

For 32bit systems

  • Win32 OpenSSL v1.0.0k Light

Step Three: Install cURL

Visit http://curl.haxx.se/download.html.

Depending on if your system is 32 or 64 bit, download the corresponding curl.exe.

For example, go to the Win64 - Generic section and download the Win64 binary with SSL support (the one where SSL is not crossed out).

Unzip the file and copy curl.exe to C:\Windows\System32

Step Four: Install Recent CA Certificates

Do not skip this step.

Download a recent copy of valid CERT files from http://curl.haxx.se/docs/caextract.html.

Copy it to the same folder as you placed curl.exe (C:\Windows\System32) and rename it curl-ca-bundle.crt.

Test cURL

Be sure you are an Admin in Canvas.

Open a DOS command window, type in the following and press enter

curl https://yourcanvas.test.instructure.com (replace [yourcanvas] with your Canvas domain name)

You should get raw HTML output on the screen.

If you get an error such as ‘Command not found’ then cURL has not been installed

Notes on Running Commands

The DOS environment doesn't seem to like single quotes. Any example that uses single quotes to surround values is invalid on windows. The single quotes must be replaced with double quotes.

curl.exe -X POST -H "Content-Type: application/zip" --data-binary @BATCH_CANVAS_ACCOUNTS-TC.zip -H "Authorization: Bearer 7Ec3AJXBsRIgvFjkcF8P3rCtzDilNm8LuHcF5fki2" "https://<yourdomain>.instructure.com/api/v1/accounts/<your_account>/sis_imports.json?import_type=instructure_csv"