I'm trying to get info from an old site that utilizes netscape HTTP cookie files to login. Here's my curl requests:
// Do login request and get cookie
curl -c cookies -X POST -i -v https://foobar.com/login
// Use generated cookie file to get more data about the user
curl -b cookies -i -v https://foobar.com/data
In PHP, you could do something like:
// Do login request and get cookie
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://foobar/login');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, './cookies');
curl_setopt($ch, CURLOPT_COOKIEFILE, './cookies');
$user = curl_exec($ch);
// Use generated cookie file to get data about the user
curl_setopt($ch, CURLOPT_URL, 'https://foobar/login');
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, './cookies');
curl_setopt($ch, CURLOPT_COOKIEFILE, './cookies');
$data = curl_exec($ch);
Is there a way to do this using the std http package in Go?