cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using CURLOPT_WRITEFUNCTION call back, not recieving all of the data

From: charles <sanders-consulting_at_attbi.com>
Date: Sat, 7 Dec 2002 15:35:12 -0800

Nevermind, returing the number of bytes seems to have fixed it

return nmemb*size;

  ----- Original Message -----
  From: charles
  To: curl-library_at_lists.sourceforge.net
  Sent: Saturday, December 07, 2002 2:22 PM
  Subject: Using CURLOPT_WRITEFUNCTION call back, not recieving all of the data

  Hello,

  I am using CURL 7.10.2 in a DLL and using write_function that looks like this

  size_t write_data ( void *ptr, size_t size, size_t nmemb, void *stream)
  {
   _Module.m_sData += (char*) ptr;
   return 1;
  }

  And im not recieving all of the data. Without setting the callback, and just executing from command line I see the entire page printed to STDOUT, what gives ? Do i need to flush the buffer somehow ?

  Here is the code

  CURL* curl;
   curl_global_init(CURL_GLOBAL_ALL);
   curl = curl_easy_init();

   curl_easy_setopt(curl, CURLOPT_COOKIEJAR,cookie.c_str());
   curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION, write_data);
   curl_easy_setopt(curl,CURLOPT_POSTFIELDS, "uname=testuser&pass=test&module=NS-User&op=login&url=%2F");
   curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION, 1);
   curl_easy_setopt(curl, CURLOPT_URL,
      "www.fishgeeks.com/user.php");
   curl_easy_perform(curl);
   curl_easy_cleanup(curl);
   curl = NULL;
   curl = curl_easy_init();
   curl_easy_setopt(curl, CURLOPT_COOKIEFILE,cookie.c_str());
   curl_easy_setopt(curl, CURLOPT_URL,
      "http://www.fishgeeks.com/modules.php?op=modload&name=phpBB2&file=index");
   curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION, write_data);
   curl_easy_perform(curl);
   curl_easy_cleanup(curl);

  Thanks for the help!

  Charles

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-12-07