Lembar Contekan cURL
Referensi curl yang dapat dicari dan dicetak — metode HTTP, header, data dan form, auth, unduhan, cookie, TLS, proxy, dan debugging. Gratis.
Dasar-dasar
12curl https://api.example.com
Kirim permintaan GET dan cetak body
curl -o page.html https://example.com
Simpan respons ke file bernama
curl -O https://example.com/file.zip
Simpan menggunakan nama file remote
curl -i https://example.com
Tampilkan header respons beserta body
curl -I https://example.com
Ambil hanya header respons (HEAD)
curl -v https://example.com
Output verbose dari permintaan/respons
curl -s https://example.com
Mode senyap, sembunyikan progres dan galat
curl -sS https://example.com
Senyap tetapi tetap tampilkan galat
curl -L https://example.com
Ikuti pengalihan HTTP (3xx)
curl https://a.com https://b.com
Minta beberapa URL dalam satu panggilan
curl 'https://x.com/p?[1-5]'
Gunakan rentang numerik untuk merulang URL
curl --version
Cetak versi dan fitur curl
Metode HTTP
9curl -X GET https://api.example.com
Kirim permintaan GET secara eksplisit
curl -X POST https://api.example.com
Kirim permintaan POST
curl -X PUT https://api.example.com/1
Kirim permintaan PUT untuk mengganti resource
curl -X PATCH https://api.example.com/1
Kirim permintaan PATCH untuk memperbarui field
curl -X DELETE https://api.example.com/1
Kirim permintaan DELETE
curl -I https://api.example.com
Kirim permintaan HEAD hanya untuk header
curl -X OPTIONS https://api.example.com
Kirim permintaan preflight OPTIONS
curl --head https://api.example.com
Bentuk panjang -I untuk permintaan HEAD
curl --request POST https://x.com
Bentuk panjang -X untuk mengatur metode
Header
10curl -H 'Accept: application/json' https://x.com
Tambahkan satu header permintaan
curl -H 'X-Token: abc' -H 'X-Env: dev' https://x.com
Tambahkan beberapa header
curl -H 'Content-Type: application/json' https://x.com
Deklarasikan tipe konten body permintaan
curl -H 'Authorization: Bearer TOKEN' https://x.com
Kirim header otorisasi bearer
curl -H 'Host: example.com' https://1.2.3.4
Timpa header Host
curl -H 'Accept-Encoding: gzip' https://x.com
Minta respons terkompresi gzip
curl -A 'MyAgent/1.0' https://x.com
Atur string User-Agent
curl -e 'https://ref.com' https://x.com
Atur header Referer
curl -H 'X-Debug:' https://x.com
Hapus header default dengan membiarkannya kosong
curl --compressed https://x.com
Minta dan dekompresi otomatis respons
Mengirim data
11curl -d 'name=Jane&age=30' https://x.com
POST data formulir URL-encoded
curl -d '@payload.json' https://x.com
POST data yang dibaca dari file
curl --data-urlencode 'q=hello world' https://x.com
POST satu field URL-encoded
curl --data-binary '@file.bin' https://x.com
POST byte mentah tanpa pemrosesan
curl -G --data-urlencode 'q=cats' https://x.com
Tambahkan data sebagai query string GET
curl -X POST -H 'Content-Type: application/json' -d '{"name":"Jane"}' https://x.com
POST body JSON
curl --json '{"name":"Jane"}' https://x.com
POST JSON dan atur header JSON otomatis
curl -F 'name=Jane' https://x.com
Kirim field formulir multipart
curl -F 'file=@photo.png' https://x.com
Unggah file sebagai form-data multipart
curl -F 'file=@a.pdf;type=application/pdf' https://x.com
Unggah file dengan tipe MIME eksplisit
curl -d '' https://x.com
POST dengan body kosong
Autentikasi
9curl -u user:pass https://x.com
Autentikasi dasar HTTP
curl -u user https://x.com
Auth dasar, minta kata sandi
curl -H 'Authorization: Bearer TOKEN' https://x.com
Kirim header token bearer
curl --oauth2-bearer TOKEN https://x.com
Kirim token bearer OAuth 2.0
curl --digest -u user:pass https://x.com
Gunakan autentikasi digest HTTP
curl --ntlm -u user:pass https://x.com
Gunakan autentikasi NTLM
curl --netrc https://x.com
Baca kredensial dari ~/.netrc
curl --netrc-file creds https://x.com
Baca kredensial dari file netrc kustom
curl -H 'X-Api-Key: KEY' https://x.com
Kirim header kunci API
Mengunduh & mengunggah
11curl -O https://x.com/file.zip
Unduh menggunakan nama file remote
curl -o out.zip https://x.com/file.zip
Unduh ke nama file pilihan
curl -OL https://x.com/file.zip
Unduh dan ikuti pengalihan
curl -C - -O https://x.com/file.zip
Lanjutkan unduhan sebagian
curl --limit-rate 200k -O https://x.com/f
Batasi kecepatan transfer
curl -r 0-1023 -o part https://x.com/f
Unduh hanya rentang byte
curl --retry 3 -O https://x.com/f
Coba ulang unduhan saat gagal
curl -T file.txt ftp://x.com/
Unggah file dengan PUT/FTP
curl -T file.txt https://x.com/up
Unggah file via HTTP PUT
curl --create-dirs -o a/b/f.txt https://x.com
Buat direktori yang hilang untuk output
curl -# -O https://x.com/file.zip
Tampilkan bilah progres sederhana
Cookie
8curl -b 'session=abc123' https://x.com
Kirim cookie secara inline
curl -b cookies.txt https://x.com
Kirim cookie dari file
curl -c cookies.txt https://x.com
Tulis cookie yang diterima ke jar
curl -b jar.txt -c jar.txt https://x.com
Baca dan perbarui cookie jar yang sama
curl -b 'a=1; b=2' https://x.com
Kirim beberapa cookie sekaligus
curl -c - https://x.com
Cetak cookie yang diterima ke stdout
curl --junk-session-cookies -b jar.txt https://x.com
Abaikan cookie sesi dari jar
curl -L -c jar.txt -b jar.txt https://x.com/login
Pertahankan sesi melintasi pengalihan
TLS / SSL
10curl -k https://x.com
Izinkan tidak aman (lewati verifikasi sertifikat)
curl --cacert ca.pem https://x.com
Verifikasi dengan bundel CA kustom
curl --capath /etc/ssl/certs https://x.com
Gunakan direktori sertifikat CA
curl --cert client.pem https://x.com
Kirim sertifikat klien
curl --cert client.pem --key client.key https://x.com
Gunakan sertifikat klien dan kunci privat
curl --tlsv1.2 https://x.com
Wajibkan minimal TLS 1.2
curl --tlsv1.3 https://x.com
Wajibkan minimal TLS 1.3
curl --tls-max 1.2 https://x.com
Batasi versi TLS maksimum
curl --ciphers ECDHE-RSA-AES128-GCM-SHA256 https://x.com
Batasi cipher TLS yang diizinkan
curl -vI https://x.com
Periksa detail handshake TLS
Proxy
9curl -x http://proxy:8080 https://x.com
Arahkan permintaan melalui proxy HTTP
curl --proxy http://proxy:8080 https://x.com
Bentuk panjang -x untuk mengatur proxy
curl -x proxy:8080 -U user:pass https://x.com
Autentikasi ke proxy
curl --proxy-user user:pass -x proxy:8080 https://x.com
Bentuk panjang kredensial proxy
curl --socks5 127.0.0.1:1080 https://x.com
Gunakan proxy SOCKS5
curl --socks5-hostname 127.0.0.1:1080 https://x.com
Proxy SOCKS5 dengan resolusi DNS remote
curl --socks4 127.0.0.1:1080 https://x.com
Gunakan proxy SOCKS4
curl --noproxy example.com https://x.com
Lewati proxy untuk host tertentu
curl -x '' https://x.com
Nonaktifkan proxy mana pun yang terkonfigurasi
Debugging & output
11curl -w '%{http_code}\n' -o /dev/null -s https://x.com
Cetak hanya kode status HTTP
curl -w '%{time_total}\n' -o /dev/null -s https://x.com
Cetak total waktu transfer
curl -w '@format.txt' https://x.com
Baca format write-out dari file
curl -D headers.txt https://x.com
Buang header respons ke file
curl -D - -o body.txt https://x.com
Header ke stdout, body ke file
curl --trace trace.txt https://x.com
Trace hex lengkap dari transfer
curl --trace-ascii - https://x.com
Trace ASCII ke stdout
curl --trace-time -v https://x.com
Tambahkan timestamp ke output verbose
curl -v https://x.com 2>&1 | less
Telusuri log verbose per halaman
curl -sS -o /dev/null -w '%{size_download}\n' https://x.com
Cetak jumlah byte yang diunduh
curl --libcurl out.c https://x.com
Hasilkan kode sumber C libcurl yang setara
Timeout & percobaan ulang
10curl --connect-timeout 5 https://x.com
Batasi fase koneksi dalam detik
curl --max-time 30 https://x.com
Batasi seluruh waktu operasi
curl --retry 3 https://x.com
Coba ulang saat galat sementara
curl --retry 3 --retry-delay 2 https://x.com
Tunggu di antara percobaan ulang
curl --retry 5 --retry-max-time 60 https://x.com
Batasi total waktu untuk percobaan ulang
curl --retry-connrefused https://x.com
Coba ulang juga saat koneksi ditolak
curl --retry-all-errors https://x.com
Coba ulang saat galat apa pun, bukan hanya sementara
curl --speed-limit 100 --speed-time 10 https://x.com
Batalkan jika terlalu lambat selama durasi tertentu
curl --keepalive-time 60 https://x.com
Atur interval keep-alive TCP
curl --expect100-timeout 1 https://x.com
Batasi tunggu untuk 100-continue
Tidak ada entri yang cocok dengan “:q”.
Butuh bantuan?
Menemukan masalah dengan alat ini? Beri tahu tim kami.