使用 libcurl 将 HTTP 请求生成为字符串

Generate HTTP request as string with libcurl

有没有办法使用 libcurl 生成 HTTP 请求并将其转换为字符串,而不发送请求?

没有。 libcurl 专为网络传输而设计,这就是它要做的。它没有简单的方法来 "export" 它在执行请求时发送到服务器的内容。