Hi Guys

I am trying to get cookies for libcurl working in my C++ app. I have messed
around with the code for 2 days to no avail and am hoping someone can point
out the problem.
I can retrieve the page but it tells me I must be logged in to access the
content. I tried to access the content with wget --load-cookies (using the
same cookie) and it worked.
Any suggestions/pointers would be much appreciated. Code below:


string url = "http://mysite.com/get=1";
/ Now set up all of the curl options
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookie.txt");
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookie.txt");

// Attempt to retrieve the remote page
result = curl_easy_perform(curl);

// Always cleanup
curl_easy_cleanup(curl);

// Did we succeed?
if (result == CURLE_OK)
{
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to