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
297
votes
11 answers

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 headers myself?
blank
  • 17,852
  • 20
  • 105
  • 159
293
votes
4 answers

How can I set the request header for curl?

How would I pass multiple values in the header for a curl request?
ryan
  • 2,931
  • 2
  • 15
  • 3
278
votes
2 answers

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 is not seeing the parameter id = 3. I tried using…
darksky
  • 20,411
  • 61
  • 165
  • 254
276
votes
11 answers

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: curl -d @request.json --header "Content-Type:…
Qiang Fu
  • 2,761
  • 2
  • 12
  • 4
274
votes
7 answers

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, we set up a curl request, with what is supposed to…
Moki
  • 5,121
  • 4
  • 21
  • 9
271
votes
18 answers

Composer install error - requires ext_curl when it's actually enabled

I'm trying to install Facebook PHP SDK with Composer. This is what I get $ composer install Loading composer repositories with package information Installing dependencies (including require-dev) Your requirements could not be resolved to an…
Michal Artazov
  • 4,368
  • 8
  • 25
  • 38
268
votes
25 answers

How do I deal with certificates using cURL while trying to access an HTTPS url?

I am getting the following error using curl: curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none How do I set this certificate verify locations?
moorecats
  • 3,242
  • 3
  • 21
  • 23
267
votes
7 answers

What is the right way to POST multipart/form-data using curl?

I used this syntax to post a file along with some parameters: curl -v -include --form "key1=value1" --form upload=localfilename URL The file is around 500K in size. First of all, I see content length to be 254 on the transmit side. Later the server…
Kamalakshi
  • 6,918
  • 3
  • 17
  • 21
263
votes
3 answers

How to pass payload via JSON file for curl?

I can successfully create a place via curl executing the following command: $ curl -vX POST https://server/api/v1/places.json -d " auth_token=B8dsbz4HExMskqUa6Qhn& \ place[name]=Fuelstation Central& \ place[city]=Grossbeeren& \ …
JJD
  • 50,076
  • 60
  • 203
  • 339
261
votes
11 answers

Using curl POST with variables defined in bash script functions

When I echo I get this, which runs when I enter it into the terminal curl -i \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ -X POST --data…
AGleasonTU
  • 2,775
  • 2
  • 14
  • 12
260
votes
8 answers

PHP - Debugging Curl

I'd like to see what the post fields in the request are before I send it. (For debugging purposes). The PHP library (class) I am using is already made (not by me), so I am trying to understand it. As far as I can tell, it uses curl_setopt() to set…
Matthew
  • 15,282
  • 27
  • 88
  • 123
260
votes
12 answers

How do I install the ext-curl extension with PHP 7?

I've installed PHP 7 using this repo, but when I try to run composer install, it's giving this error: [package] requires ext-curl * -> the requested PHP extension curl is missing from your system. With PHP 5, you can easily install it by running…
Stephan Vierkant
  • 9,674
  • 8
  • 61
  • 97
258
votes
13 answers

curl : (1) Protocol https not supported or disabled in libcurl

I'm trying to install the Rails environments on Ubuntu 11.04. When I launch the command rvm install 1.9.2 --with-openssl-dir=/usr/local the following error is received: curl : (1) Protocol https not supported or disabled in libcurl How can this be…
Giuseppe Di Federico
  • 3,501
  • 4
  • 20
  • 19
250
votes
10 answers

What is cURL in PHP?

In PHP, I see the word cURL in many PHP projects. What is it? How does it work? Reference Link: cURL
Aakash Chakravarthy
  • 10,523
  • 18
  • 61
  • 78
243
votes
20 answers

PHP - SSL certificate error: unable to get local issuer certificate

I'm running PHP Version 5.6.3 as part of XAMPP on Windows 7. When I try to use the Mandrill API, I'm getting the following error: Uncaught exception 'Mandrill_HttpError' with message 'API call to messages/send-template failed: SSL certificate…
Dor Dadush
  • 2,463
  • 3
  • 12
  • 12