gpt4 book ai didi

c++ - 如何通过 curlpp 检索响应 cookie?

转载 作者:太空狗 更新时间:2023-10-29 23:20:05 25 4
gpt4 key购买 nike

如何从 curlpp 请求中检索响应 cookie?

我想存储 HTTP GET 请求的 PHP session 。这是我当前的代码:

void Grooveshark::Connection::processPHPCookie()
{
std::ostringstream buffer;

gsDebug("Processing PHP cookie...");

try {
request.setOpt<cURLpp::Options::Url>("http://listen.grooveshark.com");
request.setOpt<cURLpp::Options::WriteStream>(&buffer);
request.perform();

// Get the PHP Session cookie here..

} catch (cURLpp::LogicError& exception) {
gsError(exception.what());
} catch (cURLpp::RuntimeError& exception) {
gsError(exception.what());
}

gsDebug("Processing complete...");
}

request 是一个 cURLpp::Easy 实例。如果您需要更多详细信息,可以找到我的源代码 here

提前致谢。

最佳答案

首先,设置exEasy.setOpt(curlpp::options::CookieFile("")然后调用exEasy.perform(),然后循环

std::list<std::string> cookies;
curlpp::infos::CookieList::get(exEasy, cookies);

关于c++ - 如何通过 curlpp 检索响应 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4356911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com