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
87
votes
2 answers

How to read TLS certificate sent by a client on the server side?

I am trying to call a service with mutual TLS using the Curl command. Curl command used: curl -k -vvvv \ --request POST \ --header "Content-Type: application/json" \ --cert client.pem:password \ --key key.pem \ …
sunsin1985
  • 2,437
  • 5
  • 22
  • 27
87
votes
6 answers

How to use PATCH verb with curl

I am trying to make a PATCH call to a server. I am using the following command: curl --data status=closed -X PATCH https://api.viafoura.com/v2/dev.viafoura.com/pages/7000000043515 Is this the correct way of sending the PATCH request? I am getting…
sheidaei
  • 9,842
  • 20
  • 63
  • 86
86
votes
6 answers

How do I unescape HTML entities in a string in Python 3.1?

I have looked all around and only found solutions for python 2.6 and earlier, NOTHING on how to do this in python 3.X. (I only have access to Win7 box.) I HAVE to be able to do this in 3.1 and preferably without external libraries. Currently, I have…
VolatileRig
  • 2,727
  • 6
  • 32
  • 44
86
votes
3 answers

How to download all links to .zip files on a given web page using wget/curl?

A page contains links to a set of .zip files, all of which I want to download. I know this can be done by wget and curl. How is it done?
uyetch
  • 2,150
  • 3
  • 28
  • 33
85
votes
2 answers

Download github release with curl

On this URL I'm able to download a .tar.gz which contains an official release. (I know it's also available on an API endpoint but this contains the test package too. Now I'm wondering why this isn't working: $ curl -O…
DenCowboy
  • 13,884
  • 38
  • 114
  • 210
84
votes
4 answers

PHP CURL & HTTPS

I found this function that does an AWESOME job (IMHO): http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl /** * Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an * array containing the HTTP server…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
84
votes
6 answers

Handling PUT/DELETE arguments in PHP

I am working on my REST client library for CodeIgniter and I am struggling to work out how to send PUT and DELETE arguments in PHP. In a few places I have seen people using the options: $this->option(CURLOPT_PUT,…
Phil Sturgeon
  • 30,637
  • 12
  • 78
  • 117
83
votes
11 answers

Copy Image from Remote Server Over HTTP

I am looking for a simple way to import/copy images from remote server to a local folder using PHP. I have no FTP access to the server, but all remote images can be accessed via HTTP (i.e. http://www.mydomain.com/myimage.jpg). Example use: A user…
GiladG
  • 1,123
  • 1
  • 8
  • 7
82
votes
13 answers

How to resolve cURL Error (7): couldn't connect to host?

I send an item code to a web service in xml format using cUrl(php). I get the correct response in localhost, but when do it server it shows cURL Error (7): couldn't connect to host And here's my code: function xml_post($post_xml, $url) { …
Raj
  • 943
  • 2
  • 10
  • 12
82
votes
1 answer

Curl setting Content-Type incorrectly

I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can see that the header is sent as urlencoded which…
Miriam P. Raphael
  • 2,633
  • 4
  • 26
  • 28
81
votes
4 answers

Test file upload using HTTP PUT method

I've written a service using HTTP PUT method for uploading a file. Web Browsers don't support PUT so I need a method for testing. It works great as a POST hitting it from a browser. update: This is what worked. I tried Poster but it suffers from the…
Speck
  • 2,259
  • 1
  • 20
  • 29
81
votes
7 answers

Configuration failed because libcurl was not found

I am trying to pull some json data from a remote server using fromJSON: > server <- 'http://111.111.000.00:3000' > streams <- fromJSON(paste(server, '/output/streams', sep=""), flatten=TRUE) Result: Error: Required package curl not found. Please…
Run
  • 54,938
  • 169
  • 450
  • 748
81
votes
6 answers

Basic authorization command for curl

How do I set up the Basic authorization using Base64 encoded credentials? I tried the below two commands, but of no use. Please suggest me the correct variant. curl -i -H 'Accept:application/json' Authorization:Basic
Amit Sharad
  • 1,041
  • 3
  • 12
  • 17
81
votes
8 answers

cURL POST command line on WINDOWS RESTful service

My problem: Using the command line tool to curl my localhost server while sending some data along with my POST request is not working. What seems to be causing the error: Imagine something like this curl -i -X POST -H 'Content-Type:…
Lothre1
  • 3,523
  • 7
  • 43
  • 64
80
votes
3 answers

Curl retry mechanism

I have a script I run to deploy two web services and a front-end application. The script calls a method that checks to see if the two back-end services are up and running. If so, deem the deploy successful, otherwise revert. The two services…
TheCoder
  • 8,413
  • 15
  • 42
  • 54