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
177
votes
3 answers

curl -GET and -X GET

Curl offers a series of different http method calls that are prefixed with a X, but also offers the same methods without. I've tried both and I can't seem to figure out the difference. Can someone explain to me quickly how these two operations…
matsko
  • 21,895
  • 21
  • 102
  • 144
177
votes
6 answers

cURL suppress response body

Is it possible instruct cURL to suppress output of response body? In my case, the response body is an HTML page, which overflows the CLI buffer, making it difficult to find the relevant information. I want to examine the other parts of the output…
BaltoStar
  • 8,165
  • 17
  • 59
  • 91
176
votes
14 answers

How do I make curl ignore the proxy?

How do I make curl ignore the proxy? Setting $NO_PROXY doesn't seem to work for me.
ksuralta
  • 16,276
  • 16
  • 38
  • 36
176
votes
11 answers

Get final URL after curl is redirected

I need to get the final URL after a page redirect preferably with curl or wget. For example http://google.com may redirect to http://www.google.com. The contents are easy to get(ex. curl --max-redirs 10 http://google.com -L), but I'm only interested…
vise
  • 12,713
  • 11
  • 52
  • 64
176
votes
25 answers

What is the curl error 52 "empty reply from server"?

I have a cron job setup on one server to run a backup script in PHP that is hosted on another server. The command I've been using is curl -sS http://www.example.com/backup.php Lately I've been getting this error when the Cron runs: curl: (52) Empty…
Paul Sheldrake
  • 7,505
  • 10
  • 38
  • 50
173
votes
8 answers

Basic HTTP and Bearer Token Authentication

I am currently developing a REST-API which is HTTP-Basic protected for the development environment. As the real authentication is done via a token, I'm still trying to figure out, how to send two authorization headers. I have tried this one: curl -i…
170
votes
14 answers

PHP cURL not working - WAMP on Windows 7 64 bit

I got my WAMP installed on my windows 7 64bit. cURL is not working, but still I got it enabled from the WAMP tray. I have also uncommented extension=php_curl.dll in php.ini for both the PHP and Apache folder. Windows give me an error message, PHP…
will.i.am
  • 2,002
  • 3
  • 20
  • 22
164
votes
7 answers

Curl GET request with json parameter

I am trying to send a "GET" request to a remote REST API from Command Prompt via cURL like this: curl -X GET \ -H "Content-type: application/json" \ -H "Accept: application/json" \ "http://server:5050/a/c/getName/{"param0":"pradeep"}" But it…
Pradeep Simha
  • 17,683
  • 18
  • 56
  • 107
162
votes
9 answers

How do I pipe or redirect the output of curl -v?

For some reason the output always gets printed to the terminal, regardless of whether I redirect it via 2> or > or |. Is there a way to get around this? Why is this happening?
jonderry
  • 23,013
  • 32
  • 104
  • 171
162
votes
7 answers

How can I find where I will be redirected using cURL in PHP?

I'm trying to make curl follow a redirect but I can't quite get it to work right. I have a string that I want to send as a GET param to a server and get the resulting URL. Example: String = Kobold Vermin Url =…
Thomas Van Nuffel
  • 1,689
  • 2
  • 12
  • 6
159
votes
18 answers

How to enable cURL in PHP / XAMPP

How do I enable cURL in PHP? ​​
Fero
  • 12,969
  • 46
  • 116
  • 157
157
votes
4 answers

PHP CURL CURLOPT_SSL_VERIFYPEER ignored

For some reason I am unable to use CURL with HTTPS. Everything was working fine untill I ran upgrade of curl libraries. Now I am experiencing this response when trying to perform CURL requests: Problem with the SSL CA cert (path? access…
Greg
  • 2,413
  • 5
  • 22
  • 23
154
votes
2 answers

RAW POST using cURL in PHP

How can I do a RAW POST in PHP using cURL? Raw post as in without any encoding, and my data is stored in a string. The data should be formatted like this: ... usual HTTP header ... Content-Length: 1039 Content-Type: text/plain 89c5fdataasdhf…
The Unknown
  • 19,224
  • 29
  • 77
  • 93
152
votes
4 answers

Is there a way to give a specific file name when saving a file via cURL?

I am pulling files using curl in the mac OS X terminal and want to give them different names. Is there a way to specify a name, such as a "save as" function when using curl?
iveytron
  • 1,669
  • 2
  • 12
  • 11
152
votes
6 answers

Curl with multiline of JSON

Consider the curl command below, is it possible to allow newline in JSON (without the minify) and execute directly in bash (Mac/Ubuntu) curl -0 -v -X POST http://www.example.com/api/users \ -H "Expect:" \ -H 'Content-Type: text/json; charset=utf-8'…
Ryan
  • 10,041
  • 27
  • 91
  • 156