How do you select the value of a specific cookie from a cookie-jar file for future requests?
I need to submit a form on a website that requires that the current sessionId be passed as form data. The sessionId is set as a cookie on the login page.
First request (authentication)
curl -d "username=my_user&pass=my_pass" http://mywebsite.com/login.php -c, --cookie-jar my-cookies
Second request (form submit)
curl -d "sessionId=jk5lkdr7cdqkn1ptqa0rmndbr7&formField1=abc&formField2=def" http://mywebsite.com/getReport.php -b, --cookie my-cookies
In the above request data, I've manually copied the session id from the cookie file. The cookie file looks like this. (sessionId = PHPSESSID)
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
mywebsite.com FALSE / FALSE 0 PHPSESSID jk5lkdr7cdqkn1ptqa0rmndbr7
.mywebsite.com TRUE / FALSE 1516507485 info crownandcaliber%40mediaiqdigital.com
.mywebsite.com TRUE / FALSE 1507867485 pref deleted
.mywebsite.com TRUE / FALSE 0 affiliate_flag Y3Jvd25hbmRjYWxpYmVyQG1lZGlhaXFkaWdpdGFsLmNvbQ%3D%3D
.mywebsite.com TRUE / FALSE 0 cookie name%3ATm8gYWR2ZXJ0aXNlciBuYW1lIGF2YWlsYWJsZQ%3D%3D%3B
Is there a way for me to progammatically pull the value of the PHPSESSID cookie which is set in the first request into the form data for the second request?
</div>