Instead of using libcurl directly, one can use STTP, which provides nicer Api, while invoking libcurl under-the-hood.
Send the request from ex. 5 using STTP.
Mind that you must install libidn
and curl
in version 7.56.0 or newer.
Take a look at this note.
brew install libidn curl