This may work as well, just work it out how...
https://curl.haxx.se/docs/http-cookies.html
Quote:
Often, if you want to mimic what a browser does on such web sites, you can record web browser HTTP traffic when using such a site and then repeat the cookie operations using curl or libcurl.