Questions tagged [curl]

cURL is a library and command-line tool for transferring data using various protocols such as HTTP, FTP and SFTP. The cURL project produces two products, libcurl and curl. This tag covers all usages of cURL, regardless of which cURL product is used.

Filter by
Sorted by
Tagged with
3730 votes
32 answers
4.1m views

How do I POST JSON data with cURL?

I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am trying to post a JSON data....
kamaci's user avatar
  • 73k
2780 votes
32 answers
2.0m views

How do I get a YouTube video thumbnail from the YouTube API?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?
CodeOverload's user avatar
  • 47.4k
1953 votes
11 answers
2.7m views

How to send a header using a HTTP request through a cURL call?

I wish to send a header to my Apache server on a Linux box. How can I achieve this via a cURL call?
gagneet's user avatar
  • 35.8k
1013 votes
15 answers
785k views

How do I measure request and response times at once using cURL?

I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester. I want to measure the request, response, and total time using cURL. My ...
sdasdadas's user avatar
  • 24k
751 votes
9 answers
809k views

How to display request headers with command line curl

Command line curl can display response header by using -D option, but I want to see what request header it is sending. How can I do that?
wwwxml's user avatar
  • 7,527
748 votes
7 answers
456k views

How do I get cURL to not show the progress bar?

I'm trying to use cURL in a script and get it to not show the progress bar. I've tried the -s, -silent, -S, and -quiet options, but none of them work. Here's a typical command I've tried: curl -s ...
adammenges's user avatar
  • 7,878
722 votes
9 answers
810k views

Getting only response header from HTTP POST using cURL

One can request only the headers using HTTP HEAD, as option -I in curl(1). $ curl -I / Lengthy HTML response bodies are a pain to get in command-line, so I'd like to get only the header as feedback ...
Jonathan Allard's user avatar
704 votes
23 answers
1.7m views

How do I install and use cURL on Windows? [closed]

I am having trouble getting cURL to run on Windows. I have downloaded a cURL zip file from here, but it seems to contain source code, not an executable. Do I need to compile cURL to run it? If yes, ...
pri_dev's user avatar
  • 11.3k
687 votes
11 answers
1.1m views

How to capture cURL output to a file?

I have a text document that contains a bunch of URLs in this format: URL = "sitehere.com" What I'm looking to do is to run curl -K myfile.txt, and get the output of the response cURL ...
Tony's user avatar
  • 8,721
636 votes
10 answers
522k views

Converting a Postman request to curl

I am calling my Java webservice (POST request) via Postman in the following manner which works perfectly fine (i.e. I can see my records getting inserted into the database): And, here's how the ...
Coder's user avatar
  • 6,491
635 votes
22 answers
1.3m views

Using cURL with a username and password?

I want to access a URL which requires a username/password. I'd like to try accessing it with curl. Right now I'm doing something like: curl http://api.somesite.com/test/blah?something=123 I get an ...
user246114's user avatar
  • 50.3k
633 votes
34 answers
1.2m views

Unable to resolve "unable to get local issuer certificate" using git on Windows with self-signed certificate

I am using Git on Windows. I installed the msysGit package. My test repository has a self signed certificate at the server. I can access and use the repository using HTTP without problems. Moving to ...
RichardHowells's user avatar
624 votes
15 answers
1.6m views

PHP, cURL, and HTTP POST example?

Can anyone show me how to do a PHP cURL with an HTTP POST? I want to send data like this: username=user1, password=passuser1, gender=1 To www.example.com I expect the cURL to return a response like ...
mysqllearner's user avatar
  • 13.5k
608 votes
24 answers
2.1m views

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I am getting error Expecting value: line 1 column 1 (char 0) when trying to decode JSON. The URL I use for the API call works fine in the browser, but gives this error when done through a curl request....
user1328021's user avatar
  • 9,140
607 votes
3 answers
351k views

Is there a way to follow redirects with command line cURL?

I know that in a php script: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); will follow redirects. Is there a way to follow redirects with command line cURL?
user1592380's user avatar
  • 34.4k
587 votes
18 answers
1.4m views

performing HTTP requests with cURL (using PROXY)

I have this proxy address: 125.119.175.48:8909 How can I perform a HTTP request using cURL like curl http://www.example.com, but specifying the proxy address of my network?
user873286's user avatar
  • 7,859
586 votes
47 answers
793k views

wget/curl large file from google drive

I'm trying to download a file from google drive in a script, and I'm having a little trouble doing so. The files I'm trying to download are here. I've looked online extensively and I finally managed ...
Arjun's user avatar
  • 6,008
586 votes
15 answers
614k views

How can I see the request headers made by curl when sending a request to the server?

I want to see the request headers made by curl when I am sending a request to the server. How can I check that?
user avatar
584 votes
14 answers
1.3m views

How to set the authorization header using cURL

How do I pass authorization header using cURL? ( executable in /usr/bin/curl).
Vidya's user avatar
  • 7,757
551 votes
11 answers
898k views

Using cURL to upload POST data with files

I would like to use cURL to not only send data parameters in HTTP POST but to also upload files with specific form name. How should I go about doing that ? HTTP Post parameters: userid = 12345 ...
thotheolh's user avatar
  • 7,050
540 votes
5 answers
647k views

How to do a PUT request with cURL?

How do I test a RESTful PUT (or DELETE) method using cURL?
John's user avatar
  • 13.2k
516 votes
37 answers
670k views

How to urlencode data for curl command?

I am trying to write a bash script for testing that takes a parameter and sends it through curl to web site. I need to url encode the value to make sure that special characters are processed properly....
Aaron's user avatar
  • 19.2k
480 votes
37 answers
1.2m views

curl: (60) SSL certificate problem: unable to get local issuer certificate

root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt * About to connect() to {abc} port 21 (#0) * Trying {abc}... *...
user3812540's user avatar
  • 4,825
479 votes
5 answers
282k views

How can I connect to a Tor hidden service using cURL in PHP?

I'm trying to connect to a Tor hidden service using the following PHP code: $url = 'http://jhiwjjlqpyawmpjx.onion/' $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, ...
frosty's user avatar
  • 4,741
469 votes
4 answers
779k views

PHP cURL custom headers

I'm wondering if/how you can add custom headers to a cURL HTTP request in PHP. I'm trying to emulate how iTunes grabs artwork and it uses these non-standard headers: X-Apple-Tz: 0 X-Apple-Store-Front:...
123's user avatar
  • 5,676
447 votes
2 answers
831k views

Call to undefined function curl_init()? [duplicate]

When i am going to implement Authorize.net payment gateway. However, I got this error: Call to undefined function curl_init() Please let me know what is wrong in it.
Pramod Kumar Sharma's user avatar
443 votes
23 answers
1.1m views

Run cURL commands from Windows console

Is there a way to install cURL in Windows in order to run cURL commands from the command prompt?
DomingoSL's user avatar
  • 14.9k
432 votes
5 answers
322k views

How can you debug a CORS request with cURL?

How can you debug CORS requests using cURL? So far I couldn't find a way to "simulate" the preflight request.
themihai's user avatar
  • 7,953
423 votes
10 answers
701k views

How to use cURL to send Cookies?

I read that sending cookies with cURL works, but not for me. I have a REST endpoint like this: class LoginResource(restful.Resource): def get(self): print(session) if 'USER_TOKEN' ...
daydreamer's user avatar
  • 87.4k
419 votes
2 answers
1.3m views

HTTP POST and GET using cURL in Linux [duplicate]

I have a server application written in ASP.NET on Windows that provides a web service. How can I call the web service in Linux with cURL?
Randhi Rupesh's user avatar
415 votes
9 answers
686k views

POST XML file using cURL command line

How can I POST an XML file to a local server http://localhost:8080 using cURL from the command line? What command should I use?
Arnab Sen Gupta's user avatar
398 votes
16 answers
607k views

Can PHP cURL retrieve response headers AND body in a single request?

Is there any way to get both headers and body for a cURL request using PHP? I found that this option: curl_setopt($ch, CURLOPT_HEADER, true); is going to return the body plus headers, but then I ...
gremo's user avatar
  • 47.3k
395 votes
23 answers
545k views

List all indexes on ElasticSearch server?

I would like to list all indexes present on an ElasticSearch server. I tried this: curl -XGET localhost:9200/ but it just gives me this: { "ok" : true, "status" : 200, "...
Eva's user avatar
  • 4,859
394 votes
5 answers
186k views

Passing a URL with brackets to curl

If I try to pass a URL to curl that contains brackets, it fails with an error: $ curl 'http://www.google.com/?TEST[]=1' curl: (3) [globbing] illegal character in range specification at pos 29 However,...
chaimp's user avatar
  • 17k
387 votes
12 answers
458k views

Simulate a specific CURL in PostMan

I am using Postman to test some Curl requests to an API server. The API developers gave us the curl command, but I can't send it from the Postman. How to make such a request from the Postman? curl -X ...
Marin Bînzari's user avatar
387 votes
6 answers
507k views

Send request to cURL with post data sourced from a file

I need to make a POST request via cURL from the command line. Data for this request is located in a file. I know that via PUT this could be done with the --upload-file option. curl host:port/post-file ...
user avatar
377 votes
3 answers
648k views

How to define the basic HTTP authentication using cURL correctly?

I'm learning Apigility (Apigility docu -> REST Service Tutorial) and trying to send a POST request with basic authentication via cURL: $ curl -X POST -i -H "Content-Type: application/hal+json" -H "...
automatix's user avatar
  • 14.1k
373 votes
7 answers
302k views

How to count items in JSON object using command line?

I'm getting this kind of JSON reply from a curl command: [ { "cid": 49, "pyn": "yi4", "hans": "亿", "hant": "億", "tid": 68, "l10n": "cent million", "pid": 1, "pos": "...
Édouard Lopez's user avatar
372 votes
13 answers
380k views

Display curl output in readable JSON format in Unix shell script

In my Unix shell script, when I execute a curl command, the result will be displayed as below which I am redirecting to file: {"type":"Show","id":"123","title":"name","description":"Funny","...
Jams's user avatar
  • 3,789
355 votes
23 answers
732k views

Curl to return http status code along with the response

I use curl to get http headers to find http status code and also return response. I get the http headers with the command curl -I http://localhost To get the response, I use the command curl http:/...
randominstanceOfLivingThing's user avatar
353 votes
5 answers
116k views

Automatically add newline at end of curl response body

If the HTTP response body for a curl request doesn't contain a trailing newline, I end up with this really annoying condition where the shell prompt is in the middle of the line, and escaping is ...
Kevin Burke's user avatar
  • 61.5k
342 votes
23 answers
530k views

cURL error 60: SSL certificate: unable to get local issuer certificate

I am trying to send an API request using Stripe but get the error message: cURL error 60: SSL certificate problem: unable to get local issuer certificate This is the code I am running: public ...
LoveAndHappiness's user avatar
319 votes
4 answers
294k views

How to send file contents as body entity using cURL

I am using cURL command line utility to send HTTP POST to a web service. I want to include a file's contents as the body entity of the POST. I have tried using -d </path/to/filename> as well ...
Roy Hinkley's user avatar
  • 10.2k
316 votes
11 answers
668k views

curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

When I try to connect to any server (e.g. google.com) using curl (or libcurl) I get the error message: curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number Verbose output: $...
Bernhard Jaeger's user avatar
310 votes
9 answers
417k views

Save file to specific folder with curl command

In a shell script, I want to download a file from some URL and save it to a specific folder. What is the specific CLI flag I should use to download files to a specific folder with the curl command, or ...
Ziyaddin Sadigov's user avatar
297 votes
11 answers
641k views

How do I make a request using HTTP basic authentication with PHP curl?

I'm building a REST web service client in PHP and at the moment I'm using curl to make requests to the service. How do I use curl to make authenticated (http basic) requests? Do I have to add the ...
blank's user avatar
  • 17.9k
295 votes
4 answers
393k views

How can I set the request header for curl?

How would I pass multiple values in the header for a curl request?
ryan's user avatar
  • 2,951
280 votes
2 answers
767k views

CURL Command Line URL Parameters

I am trying to send a DELETE request with a url parameter using CURL. I am doing: curl -H application/x-www-form-urlencoded -X DELETE http://localhost:5000/locations` -d 'id=3' However, the server ...
darksky's user avatar
  • 20.5k
278 votes
11 answers
866k views

How to use Python to execute a cURL command?

I want to execute a curl command in Python. Usually, I just need to enter the command in the terminal and press the return key. However, I don't know how it works in Python. The command shows below: ...
Qiang Fu's user avatar
  • 2,781
275 votes
7 answers
526k views

Setting Curl's Timeout in PHP

I'm running a curl request on an eXist database through php. The dataset is very large, and as a result, the database consistently takes a long amount of time to return an XML response. To fix that, ...
Moki's user avatar
  • 5,131

1
2 3 4 5
878