Hi all,
I'm just starting to use curlpp with C++ and I've to implement a
connection between my program and a django web server that will handle
the cookie authentication session. First of all, I couln't find a
working link for the curlpp API, and then I had to use the examples,
so I'm trying to do something like this:
void DataService::PostLogin(const std::string &url, const std::string
&content, const char *usrpwd, size_t size)
{
try {
curlpp::Cleanup cleaner;
curlpp::Easy request;
request.setOpt(new curlpp::options::Url(url));
request.setOpt(new curlpp::options::Verbose(true));
std::list<std::string> header;
header.push_back(std::string("Content-Type: ") + content);
header.push_back(std::string("Content-Length: " +
QString::number(int(size),10).toStdString()));
request.setOpt(new curlpp::options::HttpHeader(header));
request.setOpt(new curlpp::options::Post(true));
request.setOpt(new curlpp::options::UserPwd(usrpwd));
request.perform();
}
catch ( curlpp::LogicError & e ) {
std::cout << e.what() << std::endl;
}
catch ( curlpp::RuntimeError & e ) {
std::cout << e.what() << std::endl;
}
}
I'd like to know how to get the response with the cookie or the
message saying that the authentication was unsuccessful, how to do
that after the request.perform()?
Thanks for the help,
Fernando