I once saw him at a conference and he said curl even has an option to emit the C code to call libcurl and do the curl request you did.
I wish I had known this before.
However I mostly use wget from shell, and since I mostly work with python aiohttp/standard library/just writing the request on the socket.