cURL চিট শিট
অনুসন্ধানযোগ্য, প্রিন্টযোগ্য curl রেফারেন্স — HTTP মেথড, হেডার, ডেটা ও ফর্ম, auth, ডাউনলোড, কুকি, TLS, প্রক্সি এবং ডিবাগিং। বিনামূল্যে।
মৌলিক
12curl https://api.example.com
GET request পাঠান ও body প্রিন্ট করুন
curl -o page.html https://example.com
response নামযুক্ত ফাইলে সংরক্ষণ করুন
curl -O https://example.com/file.zip
remote ফাইল নাম দিয়ে সংরক্ষণ করুন
curl -i https://example.com
response header ও body দেখান
curl -I https://example.com
শুধু response header আনুন (HEAD)
curl -v https://example.com
request/response-এর verbose আউটপুট
curl -s https://example.com
Silent মোড, progress ও error লুকান
curl -sS https://example.com
Silent কিন্তু error দেখান
curl -L https://example.com
HTTP redirect অনুসরণ করুন (3xx)
curl https://a.com https://b.com
এক কলে একাধিক URL request করুন
curl 'https://x.com/p?[1-5]'
URL loop-এ সাংখ্যিক পরিসর ব্যবহার করুন
curl --version
curl সংস্করণ ও ফিচার প্রিন্ট করুন
HTTP method
9curl -X GET https://api.example.com
স্পষ্টভাবে GET request পাঠান
curl -X POST https://api.example.com
POST request পাঠান
curl -X PUT https://api.example.com/1
resource প্রতিস্থাপনে PUT request পাঠান
curl -X PATCH https://api.example.com/1
ফিল্ড আপডেটে PATCH request পাঠান
curl -X DELETE https://api.example.com/1
DELETE request পাঠান
curl -I https://api.example.com
শুধু header-এর জন্য HEAD request পাঠান
curl -X OPTIONS https://api.example.com
OPTIONS preflight request পাঠান
curl --head https://api.example.com
HEAD request-এর জন্য -I-এর দীর্ঘ রূপ
curl --request POST https://x.com
method সেটে -X-এর দীর্ঘ রূপ
Header
10curl -H 'Accept: application/json' https://x.com
একটি request header যোগ করুন
curl -H 'X-Token: abc' -H 'X-Env: dev' https://x.com
একাধিক header যোগ করুন
curl -H 'Content-Type: application/json' https://x.com
request body content type ঘোষণা করুন
curl -H 'Authorization: Bearer TOKEN' https://x.com
bearer authorization header পাঠান
curl -H 'Host: example.com' https://1.2.3.4
Host header override করুন
curl -H 'Accept-Encoding: gzip' https://x.com
gzip-compressed response request করুন
curl -A 'MyAgent/1.0' https://x.com
User-Agent স্ট্রিং সেট করুন
curl -e 'https://ref.com' https://x.com
Referer header সেট করুন
curl -H 'X-Debug:' https://x.com
খালি রেখে ডিফল্ট header মুছুন
curl --compressed https://x.com
response চেয়ে auto-decompress করুন
ডেটা পাঠানো
11curl -d 'name=Jane&age=30' https://x.com
URL-encoded form ডেটা POST করুন
curl -d '@payload.json' https://x.com
ফাইল থেকে পড়া ডেটা POST করুন
curl --data-urlencode 'q=hello world' https://x.com
একটি URL-encoded ফিল্ড POST করুন
curl --data-binary '@file.bin' https://x.com
প্রসেস ছাড়া raw byte POST করুন
curl -G --data-urlencode 'q=cats' https://x.com
ডেটা GET query string হিসেবে যোগ করুন
curl -X POST -H 'Content-Type: application/json' -d '{"name":"Jane"}' https://x.com
JSON body POST করুন
curl --json '{"name":"Jane"}' https://x.com
JSON POST ও স্বয়ংক্রিয়ভাবে JSON header সেট
curl -F 'name=Jane' https://x.com
multipart form ফিল্ড পাঠান
curl -F 'file=@photo.png' https://x.com
multipart form-data হিসেবে ফাইল আপলোড
curl -F 'file=@a.pdf;type=application/pdf' https://x.com
স্পষ্ট MIME type সহ ফাইল আপলোড করুন
curl -d '' https://x.com
খালি body সহ POST করুন
Authentication
9curl -u user:pass https://x.com
HTTP basic authentication
curl -u user https://x.com
Basic auth, পাসওয়ার্ড prompt করুন
curl -H 'Authorization: Bearer TOKEN' https://x.com
bearer token header পাঠান
curl --oauth2-bearer TOKEN https://x.com
OAuth 2.0 bearer token পাঠান
curl --digest -u user:pass https://x.com
HTTP digest authentication ব্যবহার করুন
curl --ntlm -u user:pass https://x.com
NTLM authentication ব্যবহার করুন
curl --netrc https://x.com
~/.netrc থেকে credential পড়ুন
curl --netrc-file creds https://x.com
কাস্টম netrc ফাইল থেকে credential পড়ুন
curl -H 'X-Api-Key: KEY' https://x.com
API key header পাঠান
ডাউনলোড ও আপলোড
11curl -O https://x.com/file.zip
remote ফাইল নাম দিয়ে ডাউনলোড করুন
curl -o out.zip https://x.com/file.zip
বাছাই করা ফাইল নামে ডাউনলোড করুন
curl -OL https://x.com/file.zip
ডাউনলোড করে redirect অনুসরণ করুন
curl -C - -O https://x.com/file.zip
আংশিক ডাউনলোড পুনরায় শুরু করুন
curl --limit-rate 200k -O https://x.com/f
ট্রান্সফার গতি সীমিত করুন
curl -r 0-1023 -o part https://x.com/f
শুধু byte পরিসর ডাউনলোড করুন
curl --retry 3 -O https://x.com/f
ব্যর্থতায় ডাউনলোড পুনরায় চেষ্টা করুন
curl -T file.txt ftp://x.com/
PUT/FTP দিয়ে ফাইল আপলোড করুন
curl -T file.txt https://x.com/up
HTTP PUT-এ ফাইল আপলোড করুন
curl --create-dirs -o a/b/f.txt https://x.com
আউটপুটের জন্য অনুপস্থিত ডিরেক্টরি তৈরি করুন
curl -# -O https://x.com/file.zip
সরল progress bar দেখান
Cookie
8curl -b 'session=abc123' https://x.com
inline cookie পাঠান
curl -b cookies.txt https://x.com
ফাইল থেকে cookie পাঠান
curl -c cookies.txt https://x.com
প্রাপ্ত cookie jar-এ লিখুন
curl -b jar.txt -c jar.txt https://x.com
একই cookie jar পড়ুন ও আপডেট করুন
curl -b 'a=1; b=2' https://x.com
একবারে একাধিক cookie পাঠান
curl -c - https://x.com
প্রাপ্ত cookie stdout-এ প্রিন্ট করুন
curl --junk-session-cookies -b jar.txt https://x.com
jar থেকে session cookie উপেক্ষা করুন
curl -L -c jar.txt -b jar.txt https://x.com/login
redirect জুড়ে session রাখুন
TLS / SSL
10curl -k https://x.com
অনিরাপদ অনুমোদন (cert যাচাই বাদ)
curl --cacert ca.pem https://x.com
কাস্টম CA bundle দিয়ে যাচাই করুন
curl --capath /etc/ssl/certs https://x.com
CA certificate-এর ডিরেক্টরি ব্যবহার করুন
curl --cert client.pem https://x.com
client certificate পাঠান
curl --cert client.pem --key client.key https://x.com
client cert ও private key ব্যবহার করুন
curl --tlsv1.2 https://x.com
অন্তত TLS 1.2 প্রয়োজন
curl --tlsv1.3 https://x.com
অন্তত TLS 1.3 প্রয়োজন
curl --tls-max 1.2 https://x.com
সর্বোচ্চ TLS সংস্করণ সীমিত করুন
curl --ciphers ECDHE-RSA-AES128-GCM-SHA256 https://x.com
অনুমোদিত TLS cipher সীমিত করুন
curl -vI https://x.com
TLS handshake বিবরণ পরিদর্শন করুন
Proxy
9curl -x http://proxy:8080 https://x.com
HTTP proxy-র মাধ্যমে request পাঠান
curl --proxy http://proxy:8080 https://x.com
proxy সেটে -x-এর দীর্ঘ রূপ
curl -x proxy:8080 -U user:pass https://x.com
proxy-তে authenticate করুন
curl --proxy-user user:pass -x proxy:8080 https://x.com
proxy credential-এর দীর্ঘ রূপ
curl --socks5 127.0.0.1:1080 https://x.com
SOCKS5 proxy ব্যবহার করুন
curl --socks5-hostname 127.0.0.1:1080 https://x.com
remote DNS resolution সহ SOCKS5 proxy
curl --socks4 127.0.0.1:1080 https://x.com
SOCKS4 proxy ব্যবহার করুন
curl --noproxy example.com https://x.com
নির্দিষ্ট host-এর জন্য proxy বাদ দিন
curl -x '' https://x.com
কনফিগার করা যেকোনো proxy নিষ্ক্রিয় করুন
ডিবাগিং ও আউটপুট
11curl -w '%{http_code}\n' -o /dev/null -s https://x.com
শুধু HTTP status কোড প্রিন্ট করুন
curl -w '%{time_total}\n' -o /dev/null -s https://x.com
মোট ট্রান্সফার সময় প্রিন্ট করুন
curl -w '@format.txt' https://x.com
ফাইল থেকে write-out ফরম্যাট পড়ুন
curl -D headers.txt https://x.com
response header ফাইলে dump করুন
curl -D - -o body.txt https://x.com
header stdout-এ, body ফাইলে
curl --trace trace.txt https://x.com
ট্রান্সফারের সম্পূর্ণ hex trace
curl --trace-ascii - https://x.com
stdout-এ ASCII trace
curl --trace-time -v https://x.com
verbose আউটপুটে timestamp যোগ করুন
curl -v https://x.com 2>&1 | less
verbose লগ page করে দেখুন
curl -sS -o /dev/null -w '%{size_download}\n' https://x.com
ডাউনলোড করা byte সংখ্যা প্রিন্ট করুন
curl --libcurl out.c https://x.com
সমতুল্য libcurl C সোর্স তৈরি করুন
Timeout ও retry
10curl --connect-timeout 5 https://x.com
সেকেন্ডে connection পর্যায় সীমিত করুন
curl --max-time 30 https://x.com
সম্পূর্ণ অপারেশন সময় সীমিত করুন
curl --retry 3 https://x.com
transient error-এ retry করুন
curl --retry 3 --retry-delay 2 https://x.com
retry প্রচেষ্টার মাঝে অপেক্ষা করুন
curl --retry 5 --retry-max-time 60 https://x.com
retry-তে মোট সময় সীমিত করুন
curl --retry-connrefused https://x.com
connection refused-এও retry করুন
curl --retry-all-errors https://x.com
শুধু transient নয়, যেকোনো error-এ retry
curl --speed-limit 100 --speed-time 10 https://x.com
দীর্ঘ সময় ধীর হলে abort করুন
curl --keepalive-time 60 https://x.com
TCP keep-alive বিরতি সেট করুন
curl --expect100-timeout 1 https://x.com
100-continue-এর অপেক্ষা সীমিত করুন
“:q”-এর সাথে কোনো এন্ট্রি মেলে না।
সাহায্য দরকার?
এই টুলে কোনো সমস্যা পেয়েছেন? আমাদের দলকে জানান।