title: CURLOPT_WRITEFUNCTION to get xml content
body: <p>I have used </p>
  
  <pre><code>curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>size_t write_data(void *ptr, size_t size, size_t count, void *stream)
  {
      printf("%*.*s", size * count, size * count, ptr);
  }
  </code></pre>
  
  <p>to get the below output but i need to get only body content</p>
  
  <pre><code>* About to connect() to 10.10.1.112 port 8081 (#0)
  *   Trying 10.10.1.112... * connected
  * Connected to 10.10.1.112 (10.10.1.112) port 8081 (#0)
  &gt; POST /iit_mobile/services/application?wsdl HTTP/1.1
  Host: 10.10.1.112:8081
  Accept: */*
  Content-type:application/soap+xml; charset=utf-8; action="http://wsdlclass.wsdlcreat.sims.test.com/userloginMethod"
  Content-Length: 629
  
  &lt; HTTP/1.1 200 OK
  &lt; Server: Apache-Coyote/1.1
  &lt; Content-Type: application/soap+xml;charset=utf-8
  &lt; Transfer-Encoding: chunked
  &lt; Date: Tue, 11 Jun 2013 13:22:35 GMT
  &lt; 
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   338    0   338    0     0     36      0 --:--:--  0:00:09 --:--:--     0* Connection #0 to host 10.10.1.112 left intact
  
  * Closing connection #0
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;soapenv:Body&gt;&lt;userloginMethodResponse xmlns="http://wsdlclass.wsdlcreat.sims.test.com"/&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>curl = curl_easy_init();
  if(curl)
  {
  
      out_fd = fopen (filename, "w");
      curl_easy_setopt(curl, CURLOPT_FILE, out_fd);
  
      headers = curl_slist_append(headers, "Content-type:application/soap+xml; charset=utf-8; action=\"http://wsdlclass.wsdlcreat.sims.test.com/login\"");
      curl_easy_setopt(curl, CURLOPT_URL, tmpbuff);
      curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
      curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
  
      curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  
      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
  
  
      curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, buffer_size);
      curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buffer);
  
      curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
      curl_easy_setopt(curl, CURLOPT_TIMEOUT, Timeout);
      curl_easy_setopt(curl, CURLOPT_ERRORBUFFER,errmsg);
  
      printf("The Server%s:Performing Transaction.....\n",__func__);
      res = curl_easy_perform(curl);
      printf("res=after culreasey perform%d\n",res);
      curl_slist_free_all(headers);
      curl_easy_cleanup(curl);
  
      fclose(out_fd);
  }
  </code></pre>