Mindsect Team
Mindsect Team

Reputation: 2581

Cannot Install cURL on Windows 7 (64-bit) Library Issues

I am unable to install cURL on Windows 7, 64-bit version. After viewing multiple tutorials, I am told to do the following:

  1. Download cURL from website (https://curl.haxx.se/download.html)
  2. Create a 'curl' directory at the base of the C drive (C:\curl)
  3. Place the curl.exe file from download into 'curl' directory (C:\curl\curl.exe)
  4. Visit certificate page (http://curl.haxx.se/docs/caextract.html)
  5. Download cacert.pem file and rename to curl-ca-bundle.crt
  6. Place curl-ca-bundle.crt file into 'curl' directory (C:\curl\curl-ca-bundle.crt)

At this point the file structure should look like this:

C:\
    - curl.exe
    - curl-ca-bundle.crt
  1. Right-click Computer and select 'Properties'
  2. Click "Advanced system settings" on the right navigation bar
  3. On System Settings window, click "Environment Variables..." button at bottom
  4. Under "System Variables" section, click "Path" variable and click "Edit..."
  5. At the end of this path, enter ";C:\curl" and click OK
  6. Return to Command Prompt and enter your curl command

For myself, I am testing a URL for my Angular Project with both Express and MongoDB installed:

curl --data 'title=test&link=http://test.com' http://localhost:3000/posts

Regardless of whether my code works or not, the cURL command returns the following error:

curl:./.libs/lt-curl.c:233: FATAL: couldn't find curl.

Any ideas is to my issue OR an alternative to installing cURL on a Windows 7 64-bit machine?

Upvotes: 2

Views: 3662

Answers (1)

Mindsect Team
Mindsect Team

Reputation: 2581

I have found the answer. It seems you cannot request data from your curl command if it has not been first sanitized (my requests contained ":" and "/"). The data needs to be sanitized first using the "data-urlencode" switch.

For example, if I try to run the following command:

curl http://localhost:3000/posts --data 'title=test'

There isn't any issue. However, if I try to pass the website that came from the link textfield in the form:

curl http://localhost:3000/posts --data 'title=test&link=http://test.com'

I will receive the following error (in Windows command prompt):

'link' is not recognized as an internal or external command, operable program or batch file.

Even if I tried with just 'dots':

curl http://localhost:3000/posts --data 'title=test&link=www.test.com'

I will receive the following error (in Windows command prompt):

curl: (6) Could not resolve host: 'link=www.test.com'

My solution was to curl the following:

curl http://localhost:3000/posts --data 'title=test' --data-urlencode 'link=http://www.test.com'

And it was curled successfully.

Initial idea provided on this page as the second answer:

Testing REST routes with curl --data, returns 404

Upvotes: 0

Related Questions