Installing and using cURL Follow

Comments

22 comments

  • Avatar
    Tom Johnson

    This is a really great article about installing cURL on Windows, and I want to link to it. Can you fix some of the Markdown formatting issues? (The bullets beneath numbered list items are getting formatted with pre tags instead of bullets.) Thanks.

  • Avatar
    Charles Nadeau

    Hi Tom, I think I fixed all the formatting issues. I added a little bit more info about using curl in Windows. For example, you can use the caret (^) as a line continuation character instead of the backslash in multiline statements.

  • Avatar
    Tom Johnson

    Awesome. Thanks Charles. One more small thing. Can you make the Bookmarks ("This article covers the following topics...") work? The last three don't seem to jump to the headings.

  • Avatar
    Charles Nadeau

    @Tom All fixed now. Let me know if you spot anything else. Thanks.

  • Avatar
    amita

    Hi I followed all the steps and and installed curl on Windows 7 64-bit. When I test it I got a error, curl.exe has stopped working. Please help me fix this

  • Avatar
    Oz Locke

    Hi. I've encountered similar issues to Hugh Gallagher, could you please detail the resolution here?

  • Avatar
    Charles Nadeau

    Hi Oz, are you on Windows? If so, have you downloaded and installed the digital certificate file as described in steps 4 and 5 in https://support.zendesk.com/hc/en-us/articles/203691436-Installing-and-using-cURL#install above?

  • Avatar
    Lloyd

    Hello, is there a way to pretty print the results? after our shortcuts are retrieved in the Command Prompt I have to manually format the data
    OS - Windows 7 64bit
    Terminal - "Console2"

  • Avatar
    Charles Nadeau

    @Lloyd, a Google search returns a number of solutions. The simplest in terms of setup is using the "JSON Formatter" extension in Chrome. You can get it from https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en. After installing it, in Chrome select Windows > Extensions, and select the "Allow access to file URLs" option for the JSON Formatter extension. This enables pretty-printing local files.

    Paste your JSON results from the console to a text file and save it with a .json extension. Then open the file in Chrome (File > Open File).

  • Avatar
    Kyle Handley

    I'm not seeing a file named ca-bundle.crt on https://curl.haxx.se/docs/caextract.html

  • Avatar
    Charles Nadeau

    Hi Kyle,


    Looks like they changed the bundle's filename from ca-bundle.crt to cacert.pem. The .pem file is still a certificate bundle. I need to confirm it on my Windows machine at home tonight, but you should be able to move the cacert.pem file to your C:\curl folder and rename it curl-ca-bundle.crt (step 5 in the procedure above). Once I confirm this works, I'll update the doc.

  • Avatar
    Charles Nadeau

    @Kyle: Confirmed on my Window 10 machine. I updated the article with the new information. Thanks for pointing out the problem.

  • Avatar
    Bj Lim

    Indeed great article Charles, it helps big.


    I've been using only Linux version so far but I have a need to try Windows version to help my colleagues and this article makes that so easy.

  • Avatar
    Keith Yeung

    Hi Charles,


    I save cacert.pem in c:\curl and rename to curl-ca-bundle.crt as per your instruction. But I get the following error when I run the curl statement in command prompt.


    C:\Users\R30>curl https://stoneapplesolutions1371715803.zendesk.com/api/v2/users
    /me.json \ -v -u {myemail}:{mypassword}
    * Adding handle: conn: 0x1d5d7b0
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x1d5d7b0) send_pipe: 1, recv_pipe: 0
    * About to connect() to stoneapplesolutions1371715803.zendesk.com port 443 (#0)
    *   Trying 192.161.156.1...
    * Connected to stoneapplesolutions1371715803.zendesk.com (192.161.156.1) port 44
    3 (#0)
    * error setting certificate verify locations:
      CAfile: c:\curl\curl-ca-bundle.crt
      CApath: none
    * Closing connection 0
    curl: (77) error setting certificate verify locations:
      CAfile: c:\curl\curl-ca-bundle.crt
      CApath: none
    * Rebuilt URL to: \/
    * Adding handle: conn: 0x1d5d7b0
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 1 (0x1d5d7b0) send_pipe: 1, recv_pipe: 0
    * Could not resolve host: \
    * Closing connection 1
    curl: (6) Could not resolve host: \

  • Avatar
    Charles Nadeau

    Hi Keith, 


    It might be some folder permission issue. See this Microsoft doc on folder permissions.


     

  • Avatar
    Keith Yeung

    Hi Charles,


    I give the full control permission to the directory. I am still getting the same error.

  • Avatar
    Charles Nadeau

    Hi Keith,


    Can you run through this troubleshooting checklist:


    * Confirm you installed the SSL version of curl from the download page at https://curl.haxx.se/download.html. It's usually the second zip file in the list. Example for Win64 systems:


     


    * Confirm the crt file is a plain text file and contains the certificates. You should be able to open it in a text editor and view the certificates (the dense blocks of characters).


    * Try placing the crt file in another folder scanned by curl.exe. According to the curl docs at https://curl.haxx.se/docs/sslcerts.html, curl will look for the crt file in the following folders in order:



    • application's directory

    • current working directory

    • Windows System directory (e.g. C:\windows\system32)

    • Windows Directory (e.g. C:\windows)

    • all directories along %PATH%


    * If all else fails, I found a page that suggest installing a Windows version of OpenSSL might help. See step 3 on http://support.gnip.com/articles/curl-on-win7.html#enable-support-for-ssl.


    You also have the option of running cURL in an insecure mode with the -k (or –insecure) option.


     

  • Avatar
    Johannes

    Fantastic tutorial, thanks!

  • Avatar
    Najla August

    Great instructions - made it easy to follow! Thanks!

  • Avatar
    Michael Genenko

    I strictly followed the instructions on Win10, the screenshots totally matched to what I saw in my system, but still i got the error while testing, as if the installation never happened: https://cl.ly/262M0C3T0M3O

    What could I do wrong?

  • Avatar
    Allen Lai (Edited )

    If you don't want to go through the steps of installing cURL on Windows, install Postman and use the import function. 100X easier!!

  • Avatar
    Moshe

    Charles,

    First thanks so much about this article, not too many companies go out of their way to explain in such detail a 3rd party application. It's one of the reason I pushed my company to switch to Zendesk.

    To add to your comment about certificates I had similar issue, I was able to make handshake but kept getting error about the certificate.

    With the help of IT I figured out that the issue is with our web filtering software.

    Web filtering software acts like a middle man between the client and the server pinging request. In other words you are not taking directly to website, each back and forth request gets first read by the filter and then re-delivered to client/server.

    To use an industry term, having a "man in the middle" is a security risk, and most websites who use https won't allow it. (like Banks etc)

    We whitelisted Zendesk so traffic to  Zendesk server bypasses the filter. and it fixed the problem. 

     

    Thanks,

    Moshe

     

Please sign in to leave a comment.

Powered by Zendesk