Force DNS resolving in cURL with the --resolve switch

It’s possible to force DNS resolving in cURL using the –resolve switch. The –resolve switch allows you to tell curl which address to request when it would resolve a given hostname. The format of the argument is domain:port:ip # HTTPS Example curl -I -L https://domain.example.org/ \ –resolve domain.example.org:443:192.168.0.1 # HTTP Example curl -I -L http://domain.example.org/ …

PHP Curl Security Hardening

Good post — with accompanying code — on PHP.Watch on how to tighten the almighty curl: Limit Curl Protocols Do not enable automatic redirects unless absolutely necessary If redirects are enabled enabled, limit allowed protocols (if different from #1 above) If redirects are enabled, set a strict limit Set a strict time-out Do not disable …

Convert Guzzle requests to curl commands with namshi/cuzzle

The other day the namshi/cuzzle PHP pacakge came in really handy. This library let’s you dump a Guzzle request to a cURL command for debug and log purposes This way I could test some things on the CLI, and easily share these tests with all my colleagues, including those without PHP installed. use Namshi\Cuzzle\Formatter\CurlFormatter; use …

httpstat – curl statistics made simple

httpstat visualizes curl(1) statistics in a way of beauty and clarity. It is a single file🌟 Python script that has no dependency👏 and is compatible with Python 3🍻. Installation through PiP or HomeBrew: pip install httpstat brew install httpstat Once installed through one of those, you can directly call httpstat: httpstat https://www.bram.us/ httpstat – curl …

About the HTTP Expect: 100-continue header …

TL;DR HTTP clients may send a Expect: 100-continue header along with POST requests to warn the server that they’re about to send a large(ish) payload. At that point the server can: Decline, by sending back 401/405 and successively closing the connection. Accept, by sending back 100 Continue, after which the client will send over the …

Test an IMAP connection with cURL

Today I needed to debug an IMAP problem. I got reports from a user (whose password I recently rotated) that Outlook wouldn’t connect, even though they had updated the password in Outlook’s settings. Checking things on the server I noticed that the connection to the server was made, but the login attempt always failed. As …

What’s the weather like in …? Just cURL it!

To know what the weather is like in a specific (or in the current city) I always Google for “{cityname} weather forecast”. Thanks to wttr.in I can now also get to know that via cURL. Just send a cURL request to the URL and voila: $ curl wttr.in Weather for City: Sint-Amandsberg, Belgium \ / …

HTTPie – Command line HTTP client

HTTPie (pronounced aych-tee-tee-pie) is a command line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. HTTPie can be used for testing, debugging, and generally …

Guzzle — PHP HTTP Client

Guzzle is a framework that includes the tools needed to create a robust web service client, including: Service descriptions for defining the inputs and outputs of an API, resource iterators for traversing paginated resources, batching for sending a large number of requests as efficiently as possible. <?php require_once ‘vendor/autoload.php’; use Guzzle\Http\Client; // Create a client …