Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

to get response using curlpp

Tags:

c++

curlpp

I am using curlpp to receive the response. I am referring this example of curlpp site http://curlpp.org/index.php/examples/64-example-14. But I am not getting where the response is stored so that I can use it for further purpose. The code is only showing the integer values of status of the request. I have gone through google also but not able to figure it out.

curlpp::Multi::Msgs msgs = requests.info();

for (curlpp::Multi::Msgs::iterator pos = msgs.begin(); pos != msgs.end(); pos++) 
{
    if (pos->second.msg == CURLMSG_DONE)
    {
        /* Find out which handle this message is about */
        if (pos->first == &request1)
        {
            printf("First request completed with status %d\n", pos->second.code);
        }
        else if (pos->first == &request2) 
        {
            printf("Second request completed with status %d\n", pos->second.code);
        }
    }
like image 641
rajbir Avatar asked May 31 '26 13:05

rajbir


1 Answers

You can specify other streams with the option WriteStream:

std::stringstream result;

request.setOpt(cURLpp::Options::WriteStream(&result));
request.perform();
like image 156
cheshir Avatar answered Jun 03 '26 02:06

cheshir