• Home
  • Raw
  • Download

Lines Matching +full:html +full:- +full:docs

1 <!--
4 SPDX-License-Identifier: curl
5 -->
11 This document assumes that you are familiar with HTML and general networking.
21 invoke `curl --help` or `curl --manual` to get basic information about it.
43 is the plain data you requested, like the actual HTML or the image etc.
47 Using curl's option [`--verbose`](https://curl.se/docs/manpage.html#-v) (`-v`
51 `--verbose` is the single most useful option when it comes to debug or even
52 understand the curl<->server interaction.
54 Sometimes even `--verbose` is not enough. Then
55 [`--trace`](https://curl.se/docs/manpage.html#-trace) and
56 [`--trace-ascii`](https://curl.se/docs/manpage.html#--trace-ascii)
60 curl --trace-ascii debugdump.txt http://www.example.com/
67 [`--trace-time`](https://curl.se/docs/manpage.html#--trace-time) option is
70 curl --trace-ascii d.txt --trace-time http://example.com/
77 [`--trace-ids`](https://curl.se/docs/manpage.html#--trace-ids) option is what
81 curl --trace-ascii d.txt --trace-ids http://example.com/
86 somewhere to avoid that, most often that is done with `-o` or `-O`.
105 [`--resolve`](https://curl.se/docs/manpage.html#--resolve) option:
107 curl --resolve www.example.org:80:127.0.0.1 http://www.example.org/
125 curl --proxy http://proxy.example.org:4321 http://remote.example.org/
140 curl -u user:password http://example.org/
143 is usually done and requested by user-oriented websites these days. They tend
163 you get a webpage returned in your terminal window. The entire HTML document
167 use curl's [`--include`](https://curl.se/docs/manpage.html#-i) (`-i`)
173 [`--head`](https://curl.se/docs/manpage.html#-I) (`-I`) option which makes
179 may see a `Content-Length:` in the response headers, but there must not be an
193 If you use [`--data`](https://curl.se/docs/manpage.html#-d) to POST to
199 curl --data name=curl http://url1.example.com http://url2.example.com
206 [`--next`](https://curl.se/docs/manpage.html#-:) option. It is basically a
208 before `--next` get the same method and get all the POST data merged into
211 When curl reaches the `--next` on the command line, it resets the method and
217 curl -I http://example.com --next http://example.com
221 curl -d score=10 http://example.com/post.cgi --next http://example.com/results.html
223 # HTML forms
227 Forms are the general way a website can present an HTML page with fields for
232 entered address on a map or using the info as a login-prompt verifying that
240 A GET-form uses the method GET, as specified in HTML like:
242 ```html
250 press-button labeled "OK". If you fill in '1905' and press the OK button,
255 If the original form was seen on the page `www.example.com/when/birth.html`,
280 ```html
290 curl --data "birthyear=1905&press=%20OK%20" http://www.example.com/when/junk.cgi
292 This kind of POST uses the Content-Type `application/x-www-form-urlencoded`
300 Recent curl versions can in fact url-encode POST data for you, like this:
302 curl --data-urlencode "name=I am Daniel" http://www.example.com
304 If you repeat `--data` several times on the command line, curl concatenates
305 all the given data pieces - and put a `&` symbol between each data segment.
311 RFC 1867-posting.
314 allows a user to upload a file could be written like this in HTML:
316 <form method="POST" enctype='multipart/form-data' action="upload.cgi">
321 This clearly shows that the Content-Type about to be sent is
322 `multipart/form-data`.
326 curl --form upload=@localfilename --form press=OK [URL]
330 A common way for HTML based applications to pass state information between
338 ```html
349 curl --data "birthyear=1905&press=OK&person=daniel" [URL]
357 An easy way to get to see this, is to save the HTML page with the form on
362 `?`-letter as GET forms are supposed to.
374 curl --upload-file uploadfile http://www.example.com/receive.cgi
389 curl --user name:password http://www.example.com
395 [`--ntlm`](https://curl.se/docs/manpage.html#--ntlm),
396 [`--digest`](https://curl.se/docs/manpage.html#--digest),
397 [`--negotiate`](https://curl.se/docs/manpage.html#--negotiate) or even
398 [`--anyauth`](https://curl.se/docs/manpage.html#--anyauth) might be
408 curl --proxy-user proxyuser:proxypassword curl.se
411 use [`--proxy-ntlm`](https://curl.se/docs/manpage.html#--proxy-ntlm), if
413 [`--proxy-digest`](https://curl.se/docs/manpage.html#--proxy-digest).
438 do it. Using curl, you can put anything you want in the referer-field and
443 curl --referer http://www.example.come http://www.example.com
447 Similar to the referer field, all HTTP requests may set the User-Agent
461 curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL]
465 curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]
482 curl --location http://www.example.com
485 page, you can safely use [`--location`](https://curl.se/docs/manpage.html#-L)
486 (`-L`) and `--data`/`--form` together. Curl only uses POST in the first
492 does not: first the html may contain a meta refresh tag that asks the browser
520 curl --cookie "name=Daniel" http://www.example.com
524 using the [`--dump-header`](https://curl.se/docs/manpage.html#-D) (`-D`)
527 curl --dump-header headers_and_cookies http://www.example.com
530 [`--cookie-jar`](https://curl.se/docs/manpage.html#-c) option described
533 Curl has a full blown cookie parsing engine built-in that comes in use if you
535 previous connection (or hand-crafted manually to fool the server into
539 curl --cookie stored_cookies_in_file http://www.example.com
542 [`--cookie`](https://curl.se/docs/manpage.html#-b) option. If you only
543 want curl to understand received cookies, use `--cookie` with a file that
548 curl --cookie nada --location http://www.example.com
552 cookies between scripts or invokes. The `--cookie` (`-b`) switch
554 and by using the `--cookie-jar` (`-c`) option you make curl write a new
557 curl --cookie cookies.txt --cookie-jar newcookies.txt \
573 built to use one out of a fairly large set of libraries - `curl -V` shows
582 you claim to be, as an addition to normal passwords. Curl supports client-
588 curl --cert mycert.pem https://secure.example.com
593 use [`--insecure`](https://curl.se/docs/manpage.html#-k) (`-k`) in case you
597 the [`SSLCERTS` document](https://curl.se/docs/sslcerts.html).
602 curl --cacert ca-bundle.pem https://example.com/
612 as `Content-Type: text/xml` (instead of the default `Content-Type`) like
615 curl --data "<xml>" --header "Content-Type: text/xml" \
616 --request PROPFIND example.com
621 curl --header "Host:" http://www.example.com
626 curl --header "Destination: http://nowhere" http://example.com
631 depending on what action to ask for. `-d` makes a POST, `-I` makes a HEAD and
632 so on. If you use the [`--request`](https://curl.se/docs/manpage.html#-X) /
633 `-X` option you can change the method keyword curl selects, but you do not
634 modify curl's behavior. This means that if you for example use -d "data" to
635 do a POST, you can modify the method to a `PROPFIND` with `-X` and curl still
637 simply adding `-X POST` in a command line like:
639 curl -X POST http://example.org/
649 problems so here's the executive run-down of how the vast majority of all
655 First, servers mostly use cookies to track the logged-in status of the
659 getting the login-form page to capture the cookies set there.
661 Some web-based login systems feature various amounts of JavaScript, and
669 In the actual `<form>` tag for the login, lots of sites fill-in
671 to first capture the HTML code for the login form and extract all the hidden
686 - Use the `--trace-ascii` option to store fully detailed logs of the requests
689 - Make sure you check for and use cookies when needed (both reading with
690 `--cookie` and writing with `--cookie-jar`)
692 - Set user-agent (with [`-A`](https://curl.se/docs/manpage.html#-A)) to
695 - Set referer (with [`-E`](https://curl.se/docs/manpage.html#-E)) like
698 - If you use POST, make sure you send all the fields and in the same order as