CURL to get/set cookies

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 5 21:36:35 PDT 2015


On Sunday, 5 April 2015 at 23:55:15 UTC, Benjamin wrote:
> I"m still not able to set the cookie. Would it be possible to 
> provide a few sample lines - to ensure I'm on the right path.  
> I appreciate any additional help!!
>
> Thanks!  Benjamin

This should work:

auto cookiesFile = "cookies.txt";

auto http = HTTP();
http.handle.set(CurlOption.cookiefile, cookiesFile);
http.handle.set(CurlOption.cookiejar , cookiesFile);

get("www.example.com/login.php?username=benjamin&password=hunter2", 
http);
get("www.example.com/action.php?...", http);


More information about the Digitalmars-d-learn mailing list