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.

The cURL project consists of a command-line tool, curl, and a C library, libcurl, for transferring data using internet protocols such as DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, SSH, Telnet and TFTP

For example, curl can be used to download a web page and save it to a file:

curl -o curltest.html www.example.com

, written in , has bindings for a number of languages. Please use the tag for questions about compiling or integrating cURL into another project (i.e. compiling with cURL support).

is an example of a project that has implemented cURL and its use has become quite popular, due to its versatility.

Common PHP Questions

Resources

43780 questions
117
votes
10 answers

curl POST format for CURLOPT_POSTFIELDS

When I use curl via POST and set CURLOPT_POSTFIELD do I have to urlencode or any special format? for example: If I want to post 2 fields, first and last: first=John&last=Smith what is the exact code/format that should be used with…
Ken
  • 2,849
  • 8
  • 24
  • 23
117
votes
5 answers

How to PUT a json object with an array using curl

I have a series of data to enter into database. The user interface to enter the data isn't good for bulk entry, so I'm trying to formulate a command line equivalent. When I examine the network request of the UI in chrome, I see a PUT request of a…
Miles Libbey
  • 1,583
  • 2
  • 10
  • 10
115
votes
6 answers

How to use cURL to get jSON data and decode the data?

So I have a link that returns a jSON object, and I need to have it decoded and put into variables in PHP. URL api.php?action=getThreads&hash=123fajwersa&node_id=4&order_by=post_date&order=desc&limit=1&grab_content&content_limit=1 This is the…
Maaz
  • 4,193
  • 6
  • 32
  • 50
115
votes
8 answers

use pipe for curl data

I'm trying to pass the cat output to curl: $ cat file | curl --data '{"title":"mytitle","input":"-"}' http://api But input is literally a -.
Jürgen Paul
  • 14,299
  • 26
  • 93
  • 133
114
votes
2 answers

Why is curl truncating this query string?

I'm sure the answer to this is going to be some painfully obvious character encoding issue... I'm using curl on the command line to test some endpoints in a python app. The endpoint takes url params of latitude and longitude. Nothing too special. …
DeaconDesperado
  • 9,977
  • 9
  • 47
  • 77
114
votes
1 answer

How to disable cURL SSL certificate verification

Hello i want to use an API for a website but there an error with my curl command. I want to disable SSL certificate verification. curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here:…
Micky
  • 1,295
  • 3
  • 8
  • 5
112
votes
14 answers

"docker pull" certificate signed by unknown authority

I was trying to pull a docker image from a docker registry but hit the following issue: $ docker pull // Error response from daemon: Get /v1/_ping: x509: certificate signed by unknown authority I…
Chen Xie
  • 3,849
  • 8
  • 27
  • 46
112
votes
6 answers

Curl Command to Repeat URL Request

Whats the syntax for a linux command that hits a URL repeatedly, x number of times. I don't need to do anything with the data, I just need to replicate hitting refresh 20 times in a browser.
mathematician
  • 1,942
  • 5
  • 19
  • 22
111
votes
3 answers

Send JSON POST request with PHP

I have this JSON data: { userID: 'a7664093-502e-4d2b-bf30-25a2b26d6021', itemKind: 0, value: 1, description: 'Saude', itemID: '03e76d0a-8bab-11e0-8250-000c29b481aa' } and I need to post to JSON…
CMartins
  • 3,247
  • 5
  • 38
  • 53
111
votes
1 answer

How to send a HTTP OPTIONS request from the command line?

I tried to use cURL but it seems that by default (Debian) is not compiled with HTTPS support and I dont want to build it myself. wget seems to have SSL support but I found no information on how to generate an OPTIONS HTTP request with wget.
sorin
  • 161,544
  • 178
  • 535
  • 806
110
votes
1 answer

curl json post request via terminal to a rails app

I'm trying to create a user on my rails app with a curl command from os x terminal. No matter how I format the data, the app returns a responses that non of my validations have passed. curl http://localhost:3000/api/1/users.json -i -X POST -d…
chris sun
  • 1,123
  • 2
  • 8
  • 5
109
votes
7 answers

How to use cURL in Java?

I want to use curl in java. Is curl built-in with Java or I have to install it from any 3rd party source to use with Java? If it needs to be separately installed, how can that be done?
moshfiqur
  • 2,065
  • 3
  • 24
  • 27
109
votes
6 answers

Curl error 60, SSL certificate issue: self signed certificate in certificate chain

I try to send curl request with my correct APP_ID, APP_SECRET etc. to the …
Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
108
votes
7 answers

POST data using the Content-Type multipart/form-data

I'm trying to upload images from my computer to a website using go. Usually, I use a bash script that sends a file and a key to the server: curl -F "image"=@"IMAGEFILE" -F "key"="KEY" URL it works fine, but I'm trying to convert this request into…
Titouan56
  • 6,932
  • 11
  • 37
  • 61
107
votes
6 answers

POST request send JSON data Java HttpUrlConnection

I have developed a Java code that convert the following cURL to java code using URL and HttpUrlConnection. the cURL is : curl -i 'http://url.com' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": {…
user3244172
  • 1,202
  • 2
  • 9
  • 8