JWK - Jackall's IT Wiki

Sécurité, Système, Réseau

Outils pour utilisateurs

Outils du site


en:curl

Curl CheatSheet

curl is an open source command line tool and library for transferring data with URL syntax

<note important>Cet article sera mis à jour au fur et à mesure… Stay tuned </note>

Fetch Web Pages (GET)

jackall@EDO:~$ curl http://wiki.jackall.net
jackall@EDO:~$ curl https://wiki.jackall.net

Redirect output to file

jackall@EDO:~$ curl http://wiki.jackall.net -o jackall_it_wiki_homepage.html

Get only server response header (HEAD)

jackall@EDO:~$ curl -I http://wiki.jackall.net
HTTP/1.1 200 OK
Server: Apache
...

Disable certificate check

jackall@EDO:~$ curl -k https://wiki.jackall.net/
HTTP/1.1 200 OK
Server: Apache
...

Cookies

jackall@EDO:~$ curl -b ~/cookie_jar -c ~/cookie_jar  https://www.google.fr
HTTP/1.1 200 OK
Server: Apache
...
  • Option -c stores cookies.
  • Option -b sends cookies.

Change cURL User-Agent

jackall@EDO:~$ curl -A "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko"  https://www.google.fr
HTTP/1.1 200 OK
Server: Apache
...

cURL through a proxy server

jackall@EDO:~$ curl -x proxy:8080  https://wiki.jackall.net
HTTP/1.1 200 OK
Server: Apache
...

HTTP POST

Forms

jackall@EDO:~$ curl --data "parameter1=value1&param2=value2"  http://www.foo.com

cURL and upload forms

jackall@EDO:~$ curl -X POST -d '@local_file_name'  http://www.foo.com

<note tip>Do not hesitate register and contribute</note>

References

en/curl.txt · Dernière modification: 2018/02/18 16:01 (modification externe)