0

抱歉,如果这是一个愚蠢的问题,但是在使用 cURLpp 发出请求时,我似乎无法摆脱控制台输出。我正在编写一个机器人,所以我需要从控制台实时读取数据,这一切都非常困难。

我尝试了几种阅读文档的方法(https://github.com/jpbarrette/curlpp/blob/master/doc/guide.pdf)我尝试了示例,但似乎无法摆脱输出

这是我的代码示例:

std::string function() {
try
{
    curlpp::Cleanup cleaner;
    curlpp::Easy request;

    request.setOpt(curlpp::options::Url("url"));
    
    request.setOpt(curlpp::options::Verbose(true));

    std::ostringstream response;
    request.setOpt(new curlpp::options::WriteStream(&response));

    request.perform();
    return response.str();

}
catch (curlpp::LogicError& e) {
    std::cout << "ERROR Logic" << std::endl;
    std::cout << e.what() << std::endl;
    return e.what();
}
catch (curlpp::RuntimeError& e) {
    std::cout << "ERROR runtime" << std::endl;
    std::cout << e.what() << std::endl;
    return e.what();
}

}

总是得到这样的东西

...

  • schannel:解密数据添加:4055
  • schannel:解密缓存:偏移4055长度16581
  • schannel:加密数据缓冲区:偏移量 0 长度 17408
  • schannel:解密数据缓冲区:偏移量 4055 长度 16581
  • schannel: schannel_recv 清理
  • schannel:解密数据返回4055
  • schannel:解密数据缓冲区:偏移量 0 长度 16581
  • 状态:执行 => 完成句柄 0xa625e8;第 2251 行(连接 #0)
  • 多完成

...

请帮助解决这个问题,在此先感谢。

4

0 回答 0