Reputation: 2581
I am unable to install cURL on Windows 7, 64-bit version. After viewing multiple tutorials, I am told to do the following:
At this point the file structure should look like this:
C:\
- curl.exe
- curl-ca-bundle.crt
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
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