• November 9, 2024

Cmd Curl

Run cURL commands from Windows console – Stack Overflow

Is there a way to install cURL in Windows in order to run cURL commands from the command prompt?
deadly1, 20013 silver badges24 bronze badges
asked Apr 26 ’10 at 2:10
8
If you are not into Cygwin, you can use native Windows builds. Some are here: curl Download Wizard.
answered Apr 26 ’10 at 2:17
Gabriel ŠčerbákGabriel Ščerbák17. 2k8 gold badges33 silver badges50 bronze badges
3
First you need to download the cURL executable. For Windows 64bit, download it from here and for Windows 32bit download from here
After that, save the file on your C: drive.
To use it, just open the command prompt and type in:
C:\curl
answered Jan 20 ’11 at 18:35
Ricardo SanchezRicardo Sanchez5, 7893 gold badges22 silver badges31 bronze badges
answered Dec 15 ’13 at 18:29
BRogersBRogers3, 5024 gold badges21 silver badges29 bronze badges
Folks that don’t literally need the curl executable, but rather just need to e. g. see or save the results of a GET request now and again, can use powershell directly. From a normal command prompt, type:
powershell -Command “(new-object net. webclient). DownloadString(”)”
which, while a bit wordy, is similar to typing
curl
in a more Unix-ish environment.
More information about net. webclient is available here: WebClient Methods ().
UPDATE: I like how ImranHafeez took this one step further in this answer. I’d prefer a simpler cmd-script however, maybe creating a file containing this:
@powershell -Command “(new-object net. DownloadString(‘%1’)”
which could be called just like the Unix-ish example above:
answered Mar 5 ’16 at 18:33
mattymatty1, 36913 silver badges21 bronze badges
2
If you use the Chocolatey package manager, you can install cURL by running this command from the command line or from PowerShell:
choco install curl
answered Jul 16 ’14 at 9:01
HelenHelen63. 3k8 gold badges175 silver badges230 bronze badges
Create batch file in windows and enjoy with cURL in windows:)
@echo off
echo You are about to use windows cURL, Enter your url after curl command below:
set /p input=”curl ”
cls
echo%input%
powershell -Command “(new-object net. DownloadString(‘%input%’)”
pause
Vasfed17k10 gold badges45 silver badges49 bronze badges
answered Apr 4 ’16 at 13:43
Visit download page – it’s incredible
Choose your sytem in list
Don’t forget SSL support, it’s obvious now, e. for
Unpack and to C:\Windows\System32
Restart cmd
Enjoy > curl
p. s. If you want another folder to store executable check your paths > echo%PATH%
answered Dec 9 ’16 at 5:32
vladkrasvladkras14. 6k4 gold badges39 silver badges51 bronze badges
it should work perfectly fine if you would download it from
— — FOR 64BIT Win7/XP OR from — FOR 32BIT Win7/XP just extract the files to c:/Windows and run it from cmd
C:\Users\WaQas>curl -v
* About to connect() to port 80 (#0)
* Trying 173. 194. 35. 105…
* connected
* Connected to (173. 105) port 80 (#0)
> GET / HTTP/1. 1
> User-Agent: curl/7. 28. 1
> Host:
> Accept: */*
>
* HTTP 1. 0, assume close after body
< HTTP/1. 0 301 Moved Permanently < Location: < Content-Type: text/html; charset=UTF-8 < Date: Tue, 05 Feb 2013 00:50:57 GMT < Expires: Thu, 07 Mar 2013 00:50:57 GMT < Cache-Control: public, max-age=2592000 < Server: gws < Content-Length: 219 < X-XSS-Protection: 1; mode=block < X-Frame-Options: SAMEORIGIN < X-Cache: MISS from LHR-CacheMARA3 < X-Cache-Lookup: HIT from LHR-CacheMARA3:64003 < Connection: close <
301 Moved

301 Moved


The document has moved

Installing and using cURL | Zendesk Developer Docs

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:
The web server’s response is displayed directly in your command-line interface. If you requested an HTML page, you get the page source — which is what a browser normally sees.
Related topic
cURL documentation
Disclaimer: Zendesk can’t provide support for third-party technologies such as cURL or Windows. Please post any issues in the comments section or search for solutions online.
Using cURL
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:
curl \ -v -u [email protected]:mypassword
The API returns a JSON object that lists the groups in your Zendesk Support instance:
{ “groups”: [ { “name”: “DJs”, “created_at”: “2009-05-13T00:07:08Z”, “updated_at”: “2011-07-22T00:11:12Z”, “id”: 211}, { “name”: “MCs”, “created_at”: “2009-08-26T00:07:08Z”, “updated_at”: “2010-05-13T00:07:08Z”, “id”: 122}]}
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: Windows 10 users can install and use a Bash shell, a Unix command-line interface that’s the same as the one in macOS. See Setting up a Bash shell in Windows 10 in this Help Center. If you use this option, ignore all 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.
Example:
curl ^ -v -u [email protected]:mypassword
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.
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:
curl {subdomain}. ^ -d ‘{“group”: {“name”: “My Group”}}’ ^ -H “Content-Type: application/json” ^ -v -u {email_address}:{password} -X POST
The statement specifies JSON data for creating a group (the -d flag stands for data). Because the JSON is enclosed in single quotes, the statement won’t work on the command line.
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 containing the following text:
{“group”: {“name”: “My Group”}}
Next, change the cURL statement to import the JSON data with the @filename syntax:
curl {subdomain}. ^ -d ^ -H “Content-Type: application/json” ^ -v -u {email_address}:{password} -X POST
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:
-d “{\”group\””: {\””name\””: \””My Group\””}}”” \

Frequently Asked Questions about cmd curl

Leave a Reply

Your email address will not be published. Required fields are marked *