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
107
votes
9 answers

How to read a CSV file from a URL with Python?

when I do curl to a API call link http://example.com/passkey=wedsmdjsjmdd curl 'http://example.com/passkey=wedsmdjsjmdd' I get the employee output data on a csv file format,…
mongotop
  • 7,114
  • 14
  • 51
  • 76
106
votes
8 answers

Making a cURL call in C#

I want to make the following curl call in my C# console application: curl -d "text=This is a block of text" \ http://api.repustate.com/v2/demokey/score.json I tried to do like the question posted here, but I cannot fill the properties…
smohamed
  • 3,234
  • 4
  • 32
  • 57
106
votes
5 answers

How do I download a tarball from GitHub using cURL?

I am trying to download a tarball from GitHub using cURL, but it does not seem to be redirecting: $ curl --insecure https://github.com/pinard/Pymacs/tarball/v0.24-beta2 You are being
saltycrane
  • 6,541
  • 6
  • 34
  • 43
105
votes
9 answers

Script to get the HTTP status code of a list of urls?

I have a list of URLS that I need to check, to see if they still work or not. I would like to write a bash script that does that for me. I only need the returned HTTP status code, i.e. 200, 404, 500 and so forth. Nothing more. EDIT Note that there…
Manu
  • 4,410
  • 6
  • 43
  • 77
105
votes
1 answer

How to post raw body data with curl?

Before you post this as a duplicate; I've tried many of the suggestions I found around SO. So far I've been using postman to post data to a Java web service. That works great as follows: I now want to do the same using curl, so I tried it using the…
kramer65
  • 50,427
  • 120
  • 308
  • 488
103
votes
22 answers

How do I make an asynchronous GET request in PHP?

I wish to make a simple GET request to another script on a different server. How do I do this? In one case, I just need to request an external script without the need for any…
Abs
  • 56,052
  • 101
  • 275
  • 409
103
votes
7 answers

How do I add a CA root certificate inside a docker image?

I am running an ASP.NET Core 1.1 Web API in a Docker 1.13.1 container on Ubuntu 14.04. When the code attempts to retrieve some data from an HTTPS server, I get this certificate authentication error: An error occurred while sending the request. --->…
Peter
  • 5,455
  • 7
  • 46
  • 68
103
votes
6 answers

How to debug SSL handshake using cURL?

I would like to troubleshoot per directory authentication with client certificate. I would specially like to find out which acceptable client certificates does server send. How do I debug SSL handshake, preferably with cURL?
Bajo
  • 1,073
  • 2
  • 8
  • 5
103
votes
10 answers

CURL ERROR: Recv failure: Connection reset by peer - PHP Curl

I'm having this strange error, CURL ERROR: Recv failure: Connection reset by peer This is how it happens, if I did not connect to the server and all of a sudden trying to connect to the server via CURL in PHP I get the error. When I run the CURL…
Elitmiar
  • 35,072
  • 73
  • 180
  • 229
100
votes
9 answers

pass JSON to HTTP POST Request

I'm trying to make a HTTP POST request to the google QPX Express API [1] using nodejs and request [2]. My code looks as follows: // create http request client to consume the QPX API var request = require("request") // JSON to be passed…
Ronin
  • 7,322
  • 6
  • 36
  • 54
100
votes
4 answers

How do I save a file using the response header filename with cURL?

This question relates to the command line version of cURL. I'm trying to download a file from a CGI script. http://example.com/perl/dl.pl?ID=2 Using a browser the filename comes up as remotefilename.gz. cURL wants to save the file as…
John
  • 5,672
  • 7
  • 34
  • 52
100
votes
3 answers

Don't Echo Out cURL

When I use this code: $ch = curl_init($url); $statuses = curl_exec($ch); curl_close($ch); I am returned what I want, but if I just use that - $statuses is echoed out onto the page. How can I stop this?
tarnfeld
  • 25,992
  • 41
  • 111
  • 146
99
votes
10 answers

Curl to grab remote filename after following location

When downloading a file using curl, how would I follow a link location and use that for the output filename (without knowing the remote filename in advance)? For example, if one clicks on the link below, you would download a filenamed …
Nick S.
  • 1,643
  • 1
  • 12
  • 13
99
votes
5 answers

Show Curl POST Request Headers? Is there a way to do this?

I'm building a Curl web automation app and am having some issue with not getting the desired outcome of my POST action, I am having some trouble figuring out how I can show the full POST request I am sending over (with headers), I have been…
Rick
  • 16,612
  • 34
  • 110
  • 163
99
votes
7 answers

PHP: Call to undefined function: simplexml_load_string()

I am implementing facebook count function using cron file. In which cron runs every 10 minutes and counts the total likes of a page. for($i=0;$i<3;$i++){ $source_url =$cars[$i]; $rest_url =…
anil
  • 991
  • 1
  • 6
  • 8