CURL: How do I save cookies between requests?

I need to go to the page and then send the post. I can log in with the following code

curl $HOST -s -L -b $COOKIE -c $COOKIE -d "login=submit&login_name=$USER&login_password=$PASS" -o $OUTPUT 

but when I try to post, I’m no longer logged in

 curl $HOSTADDNEWS -L -b $COOKIE -c $COOKIE -A $HEADER -d "title=$TITLE" -o $OUTPUT.add.news 

How to save cookie between requests?

+6
source share
1 answer

Thanks to Daniel Stenberg! The $ COOKIE variable had a slash in it ... it is still stored in the file, but cannot use it.

+1
source

Source: https://habr.com/ru/post/923052/


All Articles