Essentially, a lot of custom functions and registering callback functions. Let's go through curl's verbose output piecewise. First, the bit about the connection can mostly be filled in if you provide your own CURLOPT_OPENSOCKETFUNCTION
.
Next, the request headers can are things that you know ahead of time and can print out however you like. For the progress bar, there's CURLOPT_PROGRESSFUNCTION
, which allows you to register a callback for updates to the progress "roughly once per second."
You can also register a response header write function (CURLOPT_HEADERFUNCTION
) which you can then use to capture and/or display the response headers.
Alternatively, you can use CURLOPT_DEBUGFUNCTION
to register callbacks to get information for the headers you send out, get in response, etc.