Outils pour utilisateurs

Outils du site


tech:notes_curl_wget

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:notes_curl_wget [2026/06/07 19:12] – modification externe 127.0.0.1tech:notes_curl_wget [2026/06/17 11:06] (Version actuelle) Jean-Baptiste
Ligne 12: Ligne 12:
  * Name : URN (Uniform Resource Name)  * Name : URN (Uniform Resource Name)
  * Location : URL (Uniform Resource Locator)  * Location : URL (Uniform Resource Locator)
 +
  
 ### URI ### URI
Ligne 40: Ligne 41:
 scheme: subdomain/domain-name.Top-level-domain/sub-folder scheme: subdomain/domain-name.Top-level-domain/sub-folder
 ~~~ ~~~
 +
  
 ## wget / curl ## wget / curl
Ligne 60: Ligne 62:
 curl -x "http://127.0.0.1:8118" "http://gnu.org" curl -x "http://127.0.0.1:8118" "http://gnu.org"
 ~~~ ~~~
 +
  
 ## curl ## curl
Ligne 65: Ligne 68:
 Voir aussi **HTTPie** Voir aussi **HTTPie**
  
-Voir [Utiliser les REST API JSON avec cURL](http://www.zem.fr/rest-api-json-curl/)+Voir 
 +  * [Utiliser les REST API JSON avec cURL](http://www.zem.fr/rest-api-json-curl/) 
  
 JSON JSON
Ligne 71: Ligne 76:
 curl -k https://aap-controller.local/api/v2/users/27/roles/ -X POST -u user:password --data-raw '{"id":534}' curl -k https://aap-controller.local/api/v2/users/27/roles/ -X POST -u user:password --data-raw '{"id":534}'
 ~~~ ~~~
 +
 +~~~bash
 +curl --globoff --request POST \
 +  --header "PRIVATE-TOKEN: <your_access_token>" \
 +  --url "https://gitlab.example.com/api/v4/projects/169/pipeline?ref=master&variables[0][key]=VAR1&variables[0][value]=hello&variables[1][key]=VAR2&variables[1][value]=world"
 +
 +curl --request POST \
 +  --header "PRIVATE-TOKEN: <your_access_token>" \
 +  --header "Content-Type: application/json" \
 +  --data '{ "ref": "master", "variables": [ {"key": "VAR1", "value": "hello"}, {"key": "VAR2", "value": "world"} ] }' \
 +  --url "https://gitlab.example.com/api/v4/projects/169/pipeline"
 +~~~
 +Source : https://docs.gitlab.com/api/rest/
 +
  
 Préciser le host sans modifier les /etc/hosts Préciser le host sans modifier les /etc/hosts
Ligne 77: Ligne 96:
 ~~~ ~~~
  
-Meteo (Basé sur Wego)+Météo (Basé sur Wego)
 ~~~bash ~~~bash
 curl -4 wttr.in curl -4 wttr.in
Ligne 103: Ligne 122:
 curl --show-error --verbose -I http://www.acme.fr curl --show-error --verbose -I http://www.acme.fr
 curl --write-out "\nhttp_code=%{http_code}\ total_time=%{time_total}\n" curl --write-out "\nhttp_code=%{http_code}\ total_time=%{time_total}\n"
 +
 +curl -s -o /dev/null -k -I -w "%{http_code}\n" https://www.acme.fr
 ~~~ ~~~
  
-Add GPG key+Timeout
 ~~~bash ~~~bash
-curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -+curl -m 3 https://www.acme.fr
 ~~~ ~~~
  
-`-f` : Fail silently on server errors \\ +
-`-s` : Silent or quiet mode. Don't show progress meter or error messages \\ +
-`-S` : When used with -s, --silent, it makes curl show an error message if it fails \\  +
-`-L` : If the server reports that the requested page has moved to a different location, this option will make curl redo the request on  the  new place.+
  
  
Ligne 166: Ligne 184:
 # Send a fake UA string for the HTTP servers that sniff it # Send a fake UA string for the HTTP servers that sniff it
 user-agent = "Mozilla/5.0 Gecko" user-agent = "Mozilla/5.0 Gecko"
- 
 ~~~ ~~~
  
 Upload Upload
-~~~+~~~bash
 curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom
 +~~~
  
-HTTP POST files here: +HTTP POST files here 
-    curl --proxy 127.0.0.1:4444 -F'file=@yourfile.png' http://0xff.i2p+~~~bash 
 +curl --proxy 127.0.0.1:4444 -F'file=@yourfile.png' http://0xff.i2p 
 +~~~
  
-Or with status bar: +Or with status bar 
-    curl --proxy 127.0.0.1:4444 -T yourfile.png http://0xff.i2p | tee+~~~bash 
 +curl --proxy 127.0.0.1:4444 -T yourfile.png http://0xff.i2p | tee 
 +~~~
  
-Upload command output: +Upload command output 
-    command | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p+~~~bash 
 +command | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p 
 +~~~
  
-Upload command output with stderr: +Upload command output with stderr 
-    command 2>&1 | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p+~~~bash 
 +command 2>&1 | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p 
 +~~~
  
-Or you can shorten URLs: +Or you can shorten URLs 
-    curl --proxy 127.0.0.1:4444 -F'shorten=http://example.com/some/long/url' http://0xff.i2p+~~~bash 
 +curl --proxy 127.0.0.1:4444 -F'shorten=http://example.com/some/long/url' http://0xff.i2p
 ~~~ ~~~
  
Ligne 211: Ligne 238:
 # Saving to: ‘plop' # Saving to: ‘plop'
 ~~~ ~~~
 +
  
 #### Autres #### Autres
Ligne 293: Ligne 321:
 ~~~ ~~~
  
-Voir [[Notes SSL/TLS HTTPS client OpenSSL|Installation de la CA sous GNU/Linux]]+Voir  
 +[[Notes SSL_TLS HTTPS client OpenSSL]] 
 +* [[PKI - CA - Cert - Ajouter une autorité de certification]] 
  
 Enlever la CA Enlever la CA
tech/notes_curl_wget.1780852327.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki