title: putting CURL result in a string and not STDOUT?
body: <p>I have the following curl code, which make a request to website and retrieve data from it, it works well, but I want to store my data in a string and not in the output window. Any idea?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;curl/curl.h&gt;
  
  int main(void)
  {
    CURL *curl;
    CURLcode res;
  
    curl = curl_easy_init();
    if(curl) {
      curl_easy_setopt(curl, CURLOPT_URL, "http://api.hostip.info/get_html.php?ip=xxx.xxx.xx.xxx");
      curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
      res = curl_easy_perform(curl);
      if(res != CURLE_OK)
        fprintf(stderr, "curl_easy_perform() failed: %s\n",
                curl_easy_strerror(res));
      curl_easy_cleanup(curl);
    }
    return 0;
  }
  </code></pre>