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
80
votes
4 answers

How do you print received cookie info to stdout with curl?

How do you print received cookie info to stdout with curl? According to the man pages if you use '-' as the file name for the -c --cookie-jar option it should print the cookie to stdout. The problem is I get an error: curl: option -: is…
Brian Yeh
  • 3,119
  • 3
  • 26
  • 40
80
votes
4 answers

How do I make a PATCH request in PHP using cURL?

I have to make a PATCH request using PhP cURL. I couldn't find any documentation, so I tried the following but it isn't working. $data = "{'field_name': 'field_value'}"; $url = "http://webservice.url"; $headers = array('X-HTTP-Method-Override:…
Sandeep M
  • 2,942
  • 2
  • 13
  • 17
79
votes
6 answers

Django returning HTTP 301?

I have a django view that returns HTTP 301 on a curl request: grapefruit:~ pete$ curl -I http://someurl HTTP/1.1 301 MOVED PERMANENTLY Date: Fri, 16 Oct 2009 19:01:08 GMT Server: Apache/2.2.9 (Win32) mod_wsgi/2.5 Python/2.6.2 PHP/5.2.6 Location:…
slypete
  • 5,538
  • 11
  • 47
  • 64
78
votes
5 answers

cURL: How to display progress information while uploading?

I use the following syntax to upload files: curl --form upload=@localfilename --form press=OK [URL] How to display the progress? Thx.
Determinant
  • 3,886
  • 7
  • 31
  • 47
78
votes
3 answers

How to pass multiple parameters to cron job with curl?

I'm running two cron jobs: This one executes without a problem: curl -sS http://example.com/cronjob.php?days=1 But this doesn't run at all: curl -sS http://example.com/cronjob.php?days=1&month=1 Is this because of the ampersand (&)? If yes, how to…
Yeti
  • 5,628
  • 9
  • 45
  • 71
78
votes
6 answers

How do I copy cookies from Chrome?

I am using bash to to POST to a website that requires that I be logged in first. So I need to send the request with login cookie. So I tried logging in and keeping the cookies, but it doesn't work because the site uses javascript to hash the…
jackcogdill
  • 4,900
  • 3
  • 30
  • 48
78
votes
3 answers

How to resume interrupted download automatically in curl?

I'm working with curl in Linux. I'm downloading a part of a file in ftp server (using the -r option), but my connection is not good, it always interrupts. I want to write a script which resume download when I'm connected again. I've used this…
Bili the big
  • 807
  • 1
  • 6
  • 4
78
votes
7 answers

Special characters like @ and & in cURL POST data

How do I include special characters like @ and & in the cURL POST data? I'm trying to pass a name and password like: curl -d name=john passwd=@31&3*J https://www.mysite.com This would cause problems as @ is used for loading files and & for…
Bernhard Heijstek
  • 2,041
  • 1
  • 16
  • 20
77
votes
12 answers

GUI frontend for cURL for testing an API

I'm (manually) testing a RESTful API that makes full use of GET/POST/PUT/DELETE methods. Rather than using cURL on the command line to quickly test different input options, it would be handy if there were a windows GUI application to make this…
AdamTheHutt
  • 8,287
  • 8
  • 33
  • 33
77
votes
7 answers

How to read a websocket response with cURL

Writing a bash script to connect to GDAX's Websocket Feed at wss://ws-feed.gdax.com but curl doesn't seem to support this as I get curl "wss://ws-feed.gdax.com" curl: (1) Protocol "wss" not supported or disabled in libcurl
J. Doe
  • 985
  • 2
  • 10
  • 15
77
votes
8 answers

Run multiple curl commands in parallel

I have the following shell script. The issue is that I want to run the transactions parallel/concurrently without waiting for one request to finish to go to the next request. For example if I make 20 requests, I want them to be executed at the same…
user5836023
77
votes
3 answers

PHP - Why Use Guzzle Instead of cURL?

In my application, I originally began using cURL to retrieve data from various APIs. Today, I tried using Guzzle to complete the same task. So far, both cURL and Guzzle seem to work equally good. Judging by Github, a lot of people seem to like…
Cato Minor
  • 2,992
  • 3
  • 29
  • 42
77
votes
3 answers

How to include Authorization header in cURL POST HTTP Request in PHP?

I'm trying to access mails of a user through Gmails OAuth 2.0, and I'm figuring this out through Google's OAuth 2.0 Playground Here, they've specified I need to send this as a HTTP REQUEST: POST /mail/feed/atom/ HTTP/1.1 Host:…
user1437671
76
votes
1 answer

Binary Data Posting with curl

So basically, I'm trying to write a series of scripts to interact with Dot Net Nuke. I've been analysing the traffic and can now login and do some basic tasks. However, I've never handled binary file upload with curl. Would someone be willing to…
user798080
76
votes
4 answers

How to get info on sent PHP curl request

I'm trying to debug a curl request to a webservice 'getToken' endpoint. I'm not 100% confident that the URL and the auth info is getting written in to the curl handle correctly. I'm trying to use curl_getinfo($ch, CURLINFO_HEADER_OUT); to capture…
user101289
  • 9,888
  • 15
  • 81
  • 148