尝试使用 libcurlpp(libcurl 的 C++ 包装器)发布表单并获得响应。一切正常,但我不知道如何在 http 事务完成后以编程方式访问 curlpp::Easy 对象的响应。基本上:
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
...
curlpp::Easy foo;
foo.setOpt( new curlpp::options::Url( "http://example.com/" ) );
foo.setOpt( new curlpp::options::Verbose( true ) );
...many other options set...
foo.perform(); // this executes the HTTP transaction
当此代码运行时,因为Verbose
设置为true
我可以看到响应输出到 STDOUT。但是我如何才能访问完整的响应而不是将其转储到 STDOUT?curlpp::Easy 似乎没有任何方法可以访问响应。
谷歌中很多人问同样的问题,但没有回复。curlpp 邮件列表是一个死区,并且 curlpp 网站的 API 部分已经损坏了一年。