1LATEST VERSION 2 3 You always find news about what's going on as well as the latest versions 4 from the curl web pages, located at: 5 6 http://curl.haxx.se 7 8SIMPLE USAGE 9 10 Get the main page from Netscape's web-server: 11 12 curl http://www.netscape.com/ 13 14 Get the README file the user's home directory at funet's ftp-server: 15 16 curl ftp://ftp.funet.fi/README 17 18 Get a web page from a server using port 8000: 19 20 curl http://www.weirdserver.com:8000/ 21 22 Get a list of a directory of an FTP site: 23 24 curl ftp://cool.haxx.se/ 25 26 Get the definition of curl from a dictionary: 27 28 curl dict://dict.org/m:curl 29 30 Fetch two documents at once: 31 32 curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/ 33 34 Get a file off an FTPS server: 35 36 curl ftps://files.are.secure.com/secrets.txt 37 38 or use the more appropriate FTPS way to get the same file: 39 40 curl --ftp-ssl ftp://files.are.secure.com/secrets.txt 41 42 Get a file from an SSH server using SFTP: 43 44 curl -u username sftp://shell.example.com/etc/issue 45 46 Get a file from an SSH server using SCP using a private key to authenticate: 47 48 curl -u username: --key ~/.ssh/id_dsa --pubkey ~/.ssh/id_dsa.pub \ 49 scp://shell.example.com/~/personal.txt 50 51 Get the main page from an IPv6 web server: 52 53 curl -g "http://[2001:1890:1112:1::20]/" 54 55DOWNLOAD TO A FILE 56 57 Get a web page and store in a local file: 58 59 curl -o thatpage.html http://www.netscape.com/ 60 61 Get a web page and store in a local file, make the local file get the name 62 of the remote document (if no file name part is specified in the URL, this 63 will fail): 64 65 curl -O http://www.netscape.com/index.html 66 67 Fetch two files and store them with their remote names: 68 69 curl -O www.haxx.se/index.html -O curl.haxx.se/download.html 70 71USING PASSWORDS 72 73 FTP 74 75 To ftp files using name+passwd, include them in the URL like: 76 77 curl ftp://name:passwd@machine.domain:port/full/path/to/file 78 79 or specify them with the -u flag like 80 81 curl -u name:passwd ftp://machine.domain:port/full/path/to/file 82 83 FTPS 84 85 It is just like for FTP, but you may also want to specify and use 86 SSL-specific options for certificates etc. 87 88 Note that using FTPS:// as prefix is the "implicit" way as described in the 89 standards while the recommended "explicit" way is done by using FTP:// and 90 the --ftp-ssl option. 91 92 SFTP / SCP 93 94 This is similar to FTP, but you can specify a private key to use instead of 95 a password. Note that the private key may itself be protected by a password 96 that is unrelated to the login password of the remote system. If you 97 provide a private key file you must also provide a public key file. 98 99 HTTP 100 101 Curl also supports user and password in HTTP URLs, thus you can pick a file 102 like: 103 104 curl http://name:passwd@machine.domain/full/path/to/file 105 106 or specify user and password separately like in 107 108 curl -u name:passwd http://machine.domain/full/path/to/file 109 110 HTTP offers many different methods of authentication and curl supports 111 several: Basic, Digest, NTLM and Negotiate. Without telling which method to 112 use, curl defaults to Basic. You can also ask curl to pick the most secure 113 ones out of the ones that the server accepts for the given URL, by using 114 --anyauth. 115 116 NOTE! Since HTTP URLs don't support user and password, you can't use that 117 style when using Curl via a proxy. You _must_ use the -u style fetch 118 during such circumstances. 119 120 HTTPS 121 122 Probably most commonly used with private certificates, as explained below. 123 124PROXY 125 126 curl supports both HTTP and SOCKS proxy servers, with optional authentication. 127 It does not have special support for FTP proxy servers since there are no 128 standards for those, but it can still be made to work with many of them. You 129 can also use both HTTP and SOCKS proxies to transfer files to and from FTP 130 servers. 131 132 Get an ftp file using an HTTP proxy named my-proxy that uses port 888: 133 134 curl -x my-proxy:888 ftp://ftp.leachsite.com/README 135 136 Get a file from a HTTP server that requires user and password, using the 137 same proxy as above: 138 139 curl -u user:passwd -x my-proxy:888 http://www.get.this/ 140 141 Some proxies require special authentication. Specify by using -U as above: 142 143 curl -U user:passwd -x my-proxy:888 http://www.get.this/ 144 145 A comma-separated list of hosts and domains which do not use the proxy can 146 be specified as: 147 148 curl --noproxy localhost,get.this -x my-proxy:888 http://www.get.this/ 149 150 If the proxy is specified with --proxy1.0 instead of --proxy or -x, then 151 curl will use HTTP/1.0 instead of HTTP/1.1 for any CONNECT attempts. 152 153 curl also supports SOCKS4 and SOCKS5 proxies with --socks4 and --socks5. 154 155 See also the environment variables Curl supports that offer further proxy 156 control. 157 158 Most FTP proxy servers are set up to appear as a normal FTP server from the 159 client's perspective, with special commands to select the remote FTP server. 160 curl supports the -u, -Q and --ftp-account options that can be used to 161 set up transfers through many FTP proxies. For example, a file can be 162 uploaded to a remote FTP server using a Blue Coat FTP proxy with the 163 options: 164 165 curl -u "Remote-FTP-Username@remote.ftp.server Proxy-Username:Remote-Pass" \ 166 --ftp-account Proxy-Password --upload-file local-file \ 167 ftp://my-ftp.proxy.server:21/remote/upload/path/ 168 169 See the manual for your FTP proxy to determine the form it expects to set up 170 transfers, and curl's -v option to see exactly what curl is sending. 171 172RANGES 173 174 With HTTP 1.1 byte-ranges were introduced. Using this, a client can request 175 to get only one or more subparts of a specified document. Curl supports 176 this with the -r flag. 177 178 Get the first 100 bytes of a document: 179 180 curl -r 0-99 http://www.get.this/ 181 182 Get the last 500 bytes of a document: 183 184 curl -r -500 http://www.get.this/ 185 186 Curl also supports simple ranges for FTP files as well. Then you can only 187 specify start and stop position. 188 189 Get the first 100 bytes of a document using FTP: 190 191 curl -r 0-99 ftp://www.get.this/README 192 193UPLOADING 194 195 FTP / FTPS / SFTP / SCP 196 197 Upload all data on stdin to a specified server: 198 199 curl -T - ftp://ftp.upload.com/myfile 200 201 Upload data from a specified file, login with user and password: 202 203 curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile 204 205 Upload a local file to the remote site, and use the local file name remote 206 too: 207 208 curl -T uploadfile -u user:passwd ftp://ftp.upload.com/ 209 210 Upload a local file to get appended to the remote file: 211 212 curl -T localfile -a ftp://ftp.upload.com/remotefile 213 214 Curl also supports ftp upload through a proxy, but only if the proxy is 215 configured to allow that kind of tunneling. If it does, you can run curl in 216 a fashion similar to: 217 218 curl --proxytunnel -x proxy:port -T localfile ftp.upload.com 219 220 HTTP 221 222 Upload all data on stdin to a specified http site: 223 224 curl -T - http://www.upload.com/myfile 225 226 Note that the http server must have been configured to accept PUT before 227 this can be done successfully. 228 229 For other ways to do http data upload, see the POST section below. 230 231VERBOSE / DEBUG 232 233 If curl fails where it isn't supposed to, if the servers don't let you in, 234 if you can't understand the responses: use the -v flag to get verbose 235 fetching. Curl will output lots of info and what it sends and receives in 236 order to let the user see all client-server interaction (but it won't show 237 you the actual data). 238 239 curl -v ftp://ftp.upload.com/ 240 241 To get even more details and information on what curl does, try using the 242 --trace or --trace-ascii options with a given file name to log to, like 243 this: 244 245 curl --trace trace.txt www.haxx.se 246 247 248DETAILED INFORMATION 249 250 Different protocols provide different ways of getting detailed information 251 about specific files/documents. To get curl to show detailed information 252 about a single file, you should use -I/--head option. It displays all 253 available info on a single file for HTTP and FTP. The HTTP information is a 254 lot more extensive. 255 256 For HTTP, you can get the header information (the same as -I would show) 257 shown before the data by using -i/--include. Curl understands the 258 -D/--dump-header option when getting files from both FTP and HTTP, and it 259 will then store the headers in the specified file. 260 261 Store the HTTP headers in a separate file (headers.txt in the example): 262 263 curl --dump-header headers.txt curl.haxx.se 264 265 Note that headers stored in a separate file can be very useful at a later 266 time if you want curl to use cookies sent by the server. More about that in 267 the cookies section. 268 269POST (HTTP) 270 271 It's easy to post data using curl. This is done using the -d <data> 272 option. The post data must be urlencoded. 273 274 Post a simple "name" and "phone" guestbook. 275 276 curl -d "name=Rafael%20Sagula&phone=3320780" \ 277 http://www.where.com/guest.cgi 278 279 How to post a form with curl, lesson #1: 280 281 Dig out all the <input> tags in the form that you want to fill in. (There's 282 a perl program called formfind.pl on the curl site that helps with this). 283 284 If there's a "normal" post, you use -d to post. -d takes a full "post 285 string", which is in the format 286 287 <variable1>=<data1>&<variable2>=<data2>&... 288 289 The 'variable' names are the names set with "name=" in the <input> tags, and 290 the data is the contents you want to fill in for the inputs. The data *must* 291 be properly URL encoded. That means you replace space with + and that you 292 write weird letters with %XX where XX is the hexadecimal representation of 293 the letter's ASCII code. 294 295 Example: 296 297 (page located at http://www.formpost.com/getthis/ 298 299 <form action="post.cgi" method="post"> 300 <input name=user size=10> 301 <input name=pass type=password size=10> 302 <input name=id type=hidden value="blablabla"> 303 <input name=ding value="submit"> 304 </form> 305 306 We want to enter user 'foobar' with password '12345'. 307 308 To post to this, you enter a curl command line like: 309 310 curl -d "user=foobar&pass=12345&id=blablabla&ding=submit" (continues) 311 http://www.formpost.com/getthis/post.cgi 312 313 314 While -d uses the application/x-www-form-urlencoded mime-type, generally 315 understood by CGI's and similar, curl also supports the more capable 316 multipart/form-data type. This latter type supports things like file upload. 317 318 -F accepts parameters like -F "name=contents". If you want the contents to 319 be read from a file, use <@filename> as contents. When specifying a file, 320 you can also specify the file content type by appending ';type=<mime type>' 321 to the file name. You can also post the contents of several files in one 322 field. For example, the field name 'coolfiles' is used to send three files, 323 with different content types using the following syntax: 324 325 curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \ 326 http://www.post.com/postit.cgi 327 328 If the content-type is not specified, curl will try to guess from the file 329 extension (it only knows a few), or use the previously specified type (from 330 an earlier file if several files are specified in a list) or else it will 331 using the default type 'text/plain'. 332 333 Emulate a fill-in form with -F. Let's say you fill in three fields in a 334 form. One field is a file name which to post, one field is your name and one 335 field is a file description. We want to post the file we have written named 336 "cooltext.txt". To let curl do the posting of this data instead of your 337 favourite browser, you have to read the HTML source of the form page and 338 find the names of the input fields. In our example, the input field names 339 are 'file', 'yourname' and 'filedescription'. 340 341 curl -F "file=@cooltext.txt" -F "yourname=Daniel" \ 342 -F "filedescription=Cool text file with cool text inside" \ 343 http://www.post.com/postit.cgi 344 345 To send two files in one post you can do it in two ways: 346 347 1. Send multiple files in a single "field" with a single field name: 348 349 curl -F "pictures=@dog.gif,cat.gif" 350 351 2. Send two fields with two field names: 352 353 curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" 354 355 To send a field value literally without interpreting a leading '@' 356 or '<', or an embedded ';type=', use --form-string instead of 357 -F. This is recommended when the value is obtained from a user or 358 some other unpredictable source. Under these circumstances, using 359 -F instead of --form-string would allow a user to trick curl into 360 uploading a file. 361 362REFERRER 363 364 A HTTP request has the option to include information about which address 365 that referred to actual page. Curl allows you to specify the 366 referrer to be used on the command line. It is especially useful to 367 fool or trick stupid servers or CGI scripts that rely on that information 368 being available or contain certain data. 369 370 curl -e www.coolsite.com http://www.showme.com/ 371 372 NOTE: The Referer: [sic] field is defined in the HTTP spec to be a full URL. 373 374USER AGENT 375 376 A HTTP request has the option to include information about the browser 377 that generated the request. Curl allows it to be specified on the command 378 line. It is especially useful to fool or trick stupid servers or CGI 379 scripts that only accept certain browsers. 380 381 Example: 382 383 curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/ 384 385 Other common strings: 386 'Mozilla/3.0 (Win95; I)' Netscape Version 3 for Windows 95 387 'Mozilla/3.04 (Win95; U)' Netscape Version 3 for Windows 95 388 'Mozilla/2.02 (OS/2; U)' Netscape Version 2 for OS/2 389 'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)' NS for AIX 390 'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' NS for Linux 391 392 Note that Internet Explorer tries hard to be compatible in every way: 393 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)' MSIE for W95 394 395 Mozilla is not the only possible User-Agent name: 396 'Konqueror/1.0' KDE File Manager desktop client 397 'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser 398 399COOKIES 400 401 Cookies are generally used by web servers to keep state information at the 402 client's side. The server sets cookies by sending a response line in the 403 headers that looks like 'Set-Cookie: <data>' where the data part then 404 typically contains a set of NAME=VALUE pairs (separated by semicolons ';' 405 like "NAME1=VALUE1; NAME2=VALUE2;"). The server can also specify for what 406 path the "cookie" should be used for (by specifying "path=value"), when the 407 cookie should expire ("expire=DATE"), for what domain to use it 408 ("domain=NAME") and if it should be used on secure connections only 409 ("secure"). 410 411 If you've received a page from a server that contains a header like: 412 Set-Cookie: sessionid=boo123; path="/foo"; 413 414 it means the server wants that first pair passed on when we get anything in 415 a path beginning with "/foo". 416 417 Example, get a page that wants my name passed in a cookie: 418 419 curl -b "name=Daniel" www.sillypage.com 420 421 Curl also has the ability to use previously received cookies in following 422 sessions. If you get cookies from a server and store them in a file in a 423 manner similar to: 424 425 curl --dump-header headers www.example.com 426 427 ... you can then in a second connect to that (or another) site, use the 428 cookies from the 'headers' file like: 429 430 curl -b headers www.example.com 431 432 While saving headers to a file is a working way to store cookies, it is 433 however error-prone and not the preferred way to do this. Instead, make curl 434 save the incoming cookies using the well-known netscape cookie format like 435 this: 436 437 curl -c cookies.txt www.example.com 438 439 Note that by specifying -b you enable the "cookie awareness" and with -L 440 you can make curl follow a location: (which often is used in combination 441 with cookies). So that if a site sends cookies and a location, you can 442 use a non-existing file to trigger the cookie awareness like: 443 444 curl -L -b empty.txt www.example.com 445 446 The file to read cookies from must be formatted using plain HTTP headers OR 447 as netscape's cookie file. Curl will determine what kind it is based on the 448 file contents. In the above command, curl will parse the header and store 449 the cookies received from www.example.com. curl will send to the server the 450 stored cookies which match the request as it follows the location. The 451 file "empty.txt" may be a nonexistent file. 452 453 Alas, to both read and write cookies from a netscape cookie file, you can 454 set both -b and -c to use the same file: 455 456 curl -b cookies.txt -c cookies.txt www.example.com 457 458PROGRESS METER 459 460 The progress meter exists to show a user that something actually is 461 happening. The different fields in the output have the following meaning: 462 463 % Total % Received % Xferd Average Speed Time Curr. 464 Dload Upload Total Current Left Speed 465 0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287 466 467 From left-to-right: 468 % - percentage completed of the whole transfer 469 Total - total size of the whole expected transfer 470 % - percentage completed of the download 471 Received - currently downloaded amount of bytes 472 % - percentage completed of the upload 473 Xferd - currently uploaded amount of bytes 474 Average Speed 475 Dload - the average transfer speed of the download 476 Average Speed 477 Upload - the average transfer speed of the upload 478 Time Total - expected time to complete the operation 479 Time Current - time passed since the invoke 480 Time Left - expected time left to completion 481 Curr.Speed - the average transfer speed the last 5 seconds (the first 482 5 seconds of a transfer is based on less time of course.) 483 484 The -# option will display a totally different progress bar that doesn't 485 need much explanation! 486 487SPEED LIMIT 488 489 Curl allows the user to set the transfer speed conditions that must be met 490 to let the transfer keep going. By using the switch -y and -Y you 491 can make curl abort transfers if the transfer speed is below the specified 492 lowest limit for a specified time. 493 494 To have curl abort the download if the speed is slower than 3000 bytes per 495 second for 1 minute, run: 496 497 curl -Y 3000 -y 60 www.far-away-site.com 498 499 This can very well be used in combination with the overall time limit, so 500 that the above operation must be completed in whole within 30 minutes: 501 502 curl -m 1800 -Y 3000 -y 60 www.far-away-site.com 503 504 Forcing curl not to transfer data faster than a given rate is also possible, 505 which might be useful if you're using a limited bandwidth connection and you 506 don't want your transfer to use all of it (sometimes referred to as 507 "bandwidth throttle"). 508 509 Make curl transfer data no faster than 10 kilobytes per second: 510 511 curl --limit-rate 10K www.far-away-site.com 512 513 or 514 515 curl --limit-rate 10240 www.far-away-site.com 516 517 Or prevent curl from uploading data faster than 1 megabyte per second: 518 519 curl -T upload --limit-rate 1M ftp://uploadshereplease.com 520 521 When using the --limit-rate option, the transfer rate is regulated on a 522 per-second basis, which will cause the total transfer speed to become lower 523 than the given number. Sometimes of course substantially lower, if your 524 transfer stalls during periods. 525 526CONFIG FILE 527 528 Curl automatically tries to read the .curlrc file (or _curlrc file on win32 529 systems) from the user's home dir on startup. 530 531 The config file could be made up with normal command line switches, but you 532 can also specify the long options without the dashes to make it more 533 readable. You can separate the options and the parameter with spaces, or 534 with = or :. Comments can be used within the file. If the first letter on a 535 line is a '#'-symbol the rest of the line is treated as a comment. 536 537 If you want the parameter to contain spaces, you must enclose the entire 538 parameter within double quotes ("). Within those quotes, you specify a 539 quote as \". 540 541 NOTE: You must specify options and their arguments on the same line. 542 543 Example, set default time out and proxy in a config file: 544 545 # We want a 30 minute timeout: 546 -m 1800 547 # ... and we use a proxy for all accesses: 548 proxy = proxy.our.domain.com:8080 549 550 White spaces ARE significant at the end of lines, but all white spaces 551 leading up to the first characters of each line are ignored. 552 553 Prevent curl from reading the default file by using -q as the first command 554 line parameter, like: 555 556 curl -q www.thatsite.com 557 558 Force curl to get and display a local help page in case it is invoked 559 without URL by making a config file similar to: 560 561 # default url to get 562 url = "http://help.with.curl.com/curlhelp.html" 563 564 You can specify another config file to be read by using the -K/--config 565 flag. If you set config file name to "-" it'll read the config from stdin, 566 which can be handy if you want to hide options from being visible in process 567 tables etc: 568 569 echo "user = user:passwd" | curl -K - http://that.secret.site.com 570 571EXTRA HEADERS 572 573 When using curl in your own very special programs, you may end up needing 574 to pass on your own custom headers when getting a web page. You can do 575 this by using the -H flag. 576 577 Example, send the header "X-you-and-me: yes" to the server when getting a 578 page: 579 580 curl -H "X-you-and-me: yes" www.love.com 581 582 This can also be useful in case you want curl to send a different text in a 583 header than it normally does. The -H header you specify then replaces the 584 header curl would normally send. If you replace an internal header with an 585 empty one, you prevent that header from being sent. To prevent the Host: 586 header from being used: 587 588 curl -H "Host:" www.server.com 589 590FTP and PATH NAMES 591 592 Do note that when getting files with the ftp:// URL, the given path is 593 relative the directory you enter. To get the file 'README' from your home 594 directory at your ftp site, do: 595 596 curl ftp://user:passwd@my.site.com/README 597 598 But if you want the README file from the root directory of that very same 599 site, you need to specify the absolute file name: 600 601 curl ftp://user:passwd@my.site.com//README 602 603 (I.e with an extra slash in front of the file name.) 604 605SFTP and SCP and PATH NAMES 606 607 With sftp: and scp: URLs, the path name given is the absolute name on the 608 server. To access a file relative to the remote user's home directory, 609 prefix the file with /~/ , such as: 610 611 curl -u $USER sftp://home.example.com/~/.bashrc 612 613FTP and firewalls 614 615 The FTP protocol requires one of the involved parties to open a second 616 connection as soon as data is about to get transfered. There are two ways to 617 do this. 618 619 The default way for curl is to issue the PASV command which causes the 620 server to open another port and await another connection performed by the 621 client. This is good if the client is behind a firewall that don't allow 622 incoming connections. 623 624 curl ftp.download.com 625 626 If the server for example, is behind a firewall that don't allow connections 627 on other ports than 21 (or if it just doesn't support the PASV command), the 628 other way to do it is to use the PORT command and instruct the server to 629 connect to the client on the given (as parameters to the PORT command) IP 630 number and port. 631 632 The -P flag to curl supports a few different options. Your machine may have 633 several IP-addresses and/or network interfaces and curl allows you to select 634 which of them to use. Default address can also be used: 635 636 curl -P - ftp.download.com 637 638 Download with PORT but use the IP address of our 'le0' interface (this does 639 not work on windows): 640 641 curl -P le0 ftp.download.com 642 643 Download with PORT but use 192.168.0.10 as our IP address to use: 644 645 curl -P 192.168.0.10 ftp.download.com 646 647NETWORK INTERFACE 648 649 Get a web page from a server using a specified port for the interface: 650 651 curl --interface eth0:1 http://www.netscape.com/ 652 653 or 654 655 curl --interface 192.168.1.10 http://www.netscape.com/ 656 657HTTPS 658 659 Secure HTTP requires SSL libraries to be installed and used when curl is 660 built. If that is done, curl is capable of retrieving and posting documents 661 using the HTTPS protocol. 662 663 Example: 664 665 curl https://www.secure-site.com 666 667 Curl is also capable of using your personal certificates to get/post files 668 from sites that require valid certificates. The only drawback is that the 669 certificate needs to be in PEM-format. PEM is a standard and open format to 670 store certificates with, but it is not used by the most commonly used 671 browsers (Netscape and MSIE both use the so called PKCS#12 format). If you 672 want curl to use the certificates you use with your (favourite) browser, you 673 may need to download/compile a converter that can convert your browser's 674 formatted certificates to PEM formatted ones. This kind of converter is 675 included in recent versions of OpenSSL, and for older versions Dr Stephen 676 N. Henson has written a patch for SSLeay that adds this functionality. You 677 can get his patch (that requires an SSLeay installation) from his site at: 678 http://www.drh-consultancy.demon.co.uk/ 679 680 Example on how to automatically retrieve a document using a certificate with 681 a personal password: 682 683 curl -E /path/to/cert.pem:password https://secure.site.com/ 684 685 If you neglect to specify the password on the command line, you will be 686 prompted for the correct password before any data can be received. 687 688 Many older SSL-servers have problems with SSLv3 or TLS, that newer versions 689 of OpenSSL etc is using, therefore it is sometimes useful to specify what 690 SSL-version curl should use. Use -3, -2 or -1 to specify that exact SSL 691 version to use (for SSLv3, SSLv2 or TLSv1 respectively): 692 693 curl -2 https://secure.site.com/ 694 695 Otherwise, curl will first attempt to use v3 and then v2. 696 697 To use OpenSSL to convert your favourite browser's certificate into a PEM 698 formatted one that curl can use, do something like this (assuming netscape, 699 but IE is likely to work similarly): 700 701 You start with hitting the 'security' menu button in netscape. 702 703 Select 'certificates->yours' and then pick a certificate in the list 704 705 Press the 'export' button 706 707 enter your PIN code for the certs 708 709 select a proper place to save it 710 711 Run the 'openssl' application to convert the certificate. If you cd to the 712 openssl installation, you can do it like: 713 714 # ./apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile] 715 716 717RESUMING FILE TRANSFERS 718 719 To continue a file transfer where it was previously aborted, curl supports 720 resume on http(s) downloads as well as ftp uploads and downloads. 721 722 Continue downloading a document: 723 724 curl -C - -o file ftp://ftp.server.com/path/file 725 726 Continue uploading a document(*1): 727 728 curl -C - -T file ftp://ftp.server.com/path/file 729 730 Continue downloading a document from a web server(*2): 731 732 curl -C - -o file http://www.server.com/ 733 734 (*1) = This requires that the ftp server supports the non-standard command 735 SIZE. If it doesn't, curl will say so. 736 737 (*2) = This requires that the web server supports at least HTTP/1.1. If it 738 doesn't, curl will say so. 739 740TIME CONDITIONS 741 742 HTTP allows a client to specify a time condition for the document it 743 requests. It is If-Modified-Since or If-Unmodified-Since. Curl allow you to 744 specify them with the -z/--time-cond flag. 745 746 For example, you can easily make a download that only gets performed if the 747 remote file is newer than a local copy. It would be made like: 748 749 curl -z local.html http://remote.server.com/remote.html 750 751 Or you can download a file only if the local file is newer than the remote 752 one. Do this by prepending the date string with a '-', as in: 753 754 curl -z -local.html http://remote.server.com/remote.html 755 756 You can specify a "free text" date as condition. Tell curl to only download 757 the file if it was updated since January 12, 2012: 758 759 curl -z "Jan 12 2012" http://remote.server.com/remote.html 760 761 Curl will then accept a wide range of date formats. You always make the date 762 check the other way around by prepending it with a dash '-'. 763 764DICT 765 766 For fun try 767 768 curl dict://dict.org/m:curl 769 curl dict://dict.org/d:heisenbug:jargon 770 curl dict://dict.org/d:daniel:web1913 771 772 Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define' 773 and 'lookup'. For example, 774 775 curl dict://dict.org/find:curl 776 777 Commands that break the URL description of the RFC (but not the DICT 778 protocol) are 779 780 curl dict://dict.org/show:db 781 curl dict://dict.org/show:strat 782 783 Authentication is still missing (but this is not required by the RFC) 784 785LDAP 786 787 If you have installed the OpenLDAP library, curl can take advantage of it 788 and offer ldap:// support. 789 790 LDAP is a complex thing and writing an LDAP query is not an easy task. I do 791 advice you to dig up the syntax description for that elsewhere. Two places 792 that might suit you are: 793 794 Netscape's "Netscape Directory SDK 3.0 for C Programmer's Guide Chapter 10: 795 Working with LDAP URLs": 796 http://developer.netscape.com/docs/manuals/dirsdk/csdk30/url.htm 797 798 RFC 2255, "The LDAP URL Format" http://curl.haxx.se/rfc/rfc2255.txt 799 800 To show you an example, this is now I can get all people from my local LDAP 801 server that has a certain sub-domain in their email address: 802 803 curl -B "ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se" 804 805 If I want the same info in HTML format, I can get it by not using the -B 806 (enforce ASCII) flag. 807 808ENVIRONMENT VARIABLES 809 810 Curl reads and understands the following environment variables: 811 812 http_proxy, HTTPS_PROXY, FTP_PROXY 813 814 They should be set for protocol-specific proxies. General proxy should be 815 set with 816 817 ALL_PROXY 818 819 A comma-separated list of host names that shouldn't go through any proxy is 820 set in (only an asterisk, '*' matches all hosts) 821 822 NO_PROXY 823 824 If the host name matches one of these strings, or the host is within the 825 domain of one of these strings, transactions with that node will not be 826 proxied. 827 828 829 The usage of the -x/--proxy flag overrides the environment variables. 830 831NETRC 832 833 Unix introduced the .netrc concept a long time ago. It is a way for a user 834 to specify name and password for commonly visited ftp sites in a file so 835 that you don't have to type them in each time you visit those sites. You 836 realize this is a big security risk if someone else gets hold of your 837 passwords, so therefore most unix programs won't read this file unless it is 838 only readable by yourself (curl doesn't care though). 839 840 Curl supports .netrc files if told so (using the -n/--netrc and 841 --netrc-optional options). This is not restricted to only ftp, 842 but curl can use it for all protocols where authentication is used. 843 844 A very simple .netrc file could look something like: 845 846 machine curl.haxx.se login iamdaniel password mysecret 847 848CUSTOM OUTPUT 849 850 To better allow script programmers to get to know about the progress of 851 curl, the -w/--write-out option was introduced. Using this, you can specify 852 what information from the previous transfer you want to extract. 853 854 To display the amount of bytes downloaded together with some text and an 855 ending newline: 856 857 curl -w 'We downloaded %{size_download} bytes\n' www.download.com 858 859KERBEROS FTP TRANSFER 860 861 Curl supports kerberos4 and kerberos5/GSSAPI for FTP transfers. You need 862 the kerberos package installed and used at curl build time for it to be 863 used. 864 865 First, get the krb-ticket the normal way, like with the kinit/kauth tool. 866 Then use curl in way similar to: 867 868 curl --krb private ftp://krb4site.com -u username:fakepwd 869 870 There's no use for a password on the -u switch, but a blank one will make 871 curl ask for one and you already entered the real password to kinit/kauth. 872 873TELNET 874 875 The curl telnet support is basic and very easy to use. Curl passes all data 876 passed to it on stdin to the remote server. Connect to a remote telnet 877 server using a command line similar to: 878 879 curl telnet://remote.server.com 880 881 And enter the data to pass to the server on stdin. The result will be sent 882 to stdout or to the file you specify with -o. 883 884 You might want the -N/--no-buffer option to switch off the buffered output 885 for slow connections or similar. 886 887 Pass options to the telnet protocol negotiation, by using the -t option. To 888 tell the server we use a vt100 terminal, try something like: 889 890 curl -tTTYPE=vt100 telnet://remote.server.com 891 892 Other interesting options for it -t include: 893 894 - XDISPLOC=<X display> Sets the X display location. 895 896 - NEW_ENV=<var,val> Sets an environment variable. 897 898 NOTE: the telnet protocol does not specify any way to login with a specified 899 user and password so curl can't do that automatically. To do that, you need 900 to track when the login prompt is received and send the username and 901 password accordingly. 902 903PERSISTENT CONNECTIONS 904 905 Specifying multiple files on a single command line will make curl transfer 906 all of them, one after the other in the specified order. 907 908 libcurl will attempt to use persistent connections for the transfers so that 909 the second transfer to the same host can use the same connection that was 910 already initiated and was left open in the previous transfer. This greatly 911 decreases connection time for all but the first transfer and it makes a far 912 better use of the network. 913 914 Note that curl cannot use persistent connections for transfers that are used 915 in subsequence curl invokes. Try to stuff as many URLs as possible on the 916 same command line if they are using the same host, as that'll make the 917 transfers faster. If you use a http proxy for file transfers, practically 918 all transfers will be persistent. 919 920MULTIPLE TRANSFERS WITH A SINGLE COMMAND LINE 921 922 As is mentioned above, you can download multiple files with one command line 923 by simply adding more URLs. If you want those to get saved to a local file 924 instead of just printed to stdout, you need to add one save option for each 925 URL you specify. Note that this also goes for the -O option (but not 926 --remote-name-all). 927 928 For example: get two files and use -O for the first and a custom file 929 name for the second: 930 931 curl -O http://url.com/file.txt ftp://ftp.com/moo.exe -o moo.jpg 932 933 You can also upload multiple files in a similar fashion: 934 935 curl -T local1 ftp://ftp.com/moo.exe -T local2 ftp://ftp.com/moo2.txt 936 937IPv6 938 939 curl will connect to a server with IPv6 when a host lookup returns an IPv6 940 address and fall back to IPv4 if the connection fails. The --ipv4 and --ipv6 941 options can specify which address to use when both are available. IPv6 942 addresses can also be specified directly in URLs using the syntax: 943 944 http://[2001:1890:1112:1::20]/overview.html 945 946 When this style is used, the -g option must be given to stop curl from 947 interpreting the square brackets as special globbing characters. Link local 948 and site local addresses including a scope identifier, such as fe80::1234%1, 949 may also be used, but the scope portion must be numeric and the percent 950 character must be URL escaped. The previous example in an SFTP URL might 951 look like: 952 953 sftp://[fe80::1234%251]/ 954 955 IPv6 addresses provided other than in URLs (e.g. to the --proxy, --interface 956 or --ftp-port options) should not be URL encoded. 957 958 959MAILING LISTS 960 961 For your convenience, we have several open mailing lists to discuss curl, 962 its development and things relevant to this. Get all info at 963 http://curl.haxx.se/mail/. Some of the lists available are: 964 965 curl-users 966 967 Users of the command line tool. How to use it, what doesn't work, new 968 features, related tools, questions, news, installations, compilations, 969 running, porting etc. 970 971 curl-library 972 973 Developers using or developing libcurl. Bugs, extensions, improvements. 974 975 curl-announce 976 977 Low-traffic. Only receives announcements of new public versions. At worst, 978 that makes something like one or two mails per month, but usually only one 979 mail every second month. 980 981 curl-and-php 982 983 Using the curl functions in PHP. Everything curl with a PHP angle. Or PHP 984 with a curl angle. 985 986 curl-and-python 987 988 Python hackers using curl with or without the python binding pycurl. 989 990 Please direct curl questions, feature requests and trouble reports to one of 991 these mailing lists instead of mailing any individual. 992