3

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);
        }
    }
rajbir
  • 39
  • 1
  • 3
  • 1
    I edited the Q to make it more readable and you broke it again? Grrr! – Alok Save Jun 19 '11 at 07:17
  • @Als I fixed it, waiting for someone to accept edit. –  Jun 19 '11 at 07:18
  • 1
    @Keoki Zee: I know you did and all in good spirit of SO, But I already had done it and the OP broke it again, which you had to fixed..And i didn't accept your edit because We can't keep doing this recursively, let the OP fix it! – Alok Save Jun 19 '11 at 07:22

2 Answers2

6

You can specify other streams with the option WriteStream:

std::stringstream result;

request.setOpt(cURLpp::Options::WriteStream(&result));
request.perform();
cheshir
  • 71
  • 1
  • 3
1

Read the previous examples, by default when you say perform it goes to the stdout or you can specify other streams.

From the same site, different example http://curlpp.org/index.php/examples/48-example-01

myRequest.perform();
os << myRequest;

Where os is a custom output stream

so for two streams like this example add something like

os1 << request1;
os2 << request2;

to get both the responses

Adithya Surampudi
  • 4,354
  • 1
  • 17
  • 17