Technology2 min read

Curl Cookbook

By · Published by Everything Blog

In short

A new curl cookbook created by Browserling provides a collection of practical command-line recipes used daily by the team to streamline tasks and improve their product. Key commands detailed in the reference include methods for making POST and GET requests, adding POST data, constructing query strings, and including custom HTTP headers. Additional recipes explain how to change user agents, set cookies, add referrers, follow 3XX redirects, and utilize basic HTTP authentication.

Key points

  • A new curl cookbook created by Browserling provides a collection of practical command-lin…: A new curl cookbook created by Browserling provides a collection of practical command-line recipes used daily by the team to streamline tasks and improve their product.
  • Key commands detailed in the reference include methods for making POST and GET requests,…: Key commands detailed in the reference include methods for making POST and GET requests, adding POST data, constructing query strings, and including custom HTTP headers.
  • Additional recipes explain how to change user agents, set cookies, add referrers, follow…: Additional recipes explain how to change user agents, set cookies, add referrers, follow 3XX redirects, and utilize basic HTTP authentication.

Sources checked by our analysis pipeline: 1

I love to cook with curl. Here are some useful curl recipes I often use.

-

Make a POST Request (TLDR: Use

-X POST

argument) -

Add POST Data to a Request (TLDR: Use

-d var=val

argument) -

Construct a Query String (TLDR: Use

-G

argument) -

Add HTTP Headers (TLDR: Use

-H 'Header: Value'

argument) -

Change the User Agent (TLDR: Use

-A 'User Agent'

argument) -

Set Cookies (TLDR: Use

-b name=value

argument) -

Add a Referrer (TLDR: Use

-e URL

argument) -

Follow a 3XX Redirect (TLDR: Use

-L

argument) -

Use the Basic HTTP Authentication (TLDR: Use

-u user:pass

argument) -

Print the Response Headers (TLDR: Use

-i

argument) -

Use a Proxy (TLDR: Use

-x protocol://host:port

argument) -

Ignore the SSL Certificate (TLDR: Use

-k

argument) -

Make Curl Silent (TLDR: Use

-s

argument) -

Save the Response to a File (TLDR: Use

-o file

argument) -

Make Curl Slow (TLDR: Use

--limit-rate 8k

(8KB/sec) argument) -

Debug Curl Requests (TLDR: Use

-v

or--trace

arguments) - Make a GET Request (TLDR: No arguments required, it's the default)

Created by Browserling

This curl cookbook was created by me and my team at Browserling. We use recipes from this cookbook every day to get things done and improve our product. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my curl cookbook, then I love you, too! Use coupon code CURLLING to get a discount at my company.

Original source: catonmat.net

Technology