Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CURL: How retain cookies between requests?

Tags:

linux

bash

curl

I need to login to a page and then submit an entry. i'm able to login 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 submit an entry i'm not logged in anymore

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

How to retain cookies between requests?

like image 738
Crazy_Bash Avatar asked Aug 16 '12 16:08

Crazy_Bash


1 Answers

Thanks to Daniel Stenberg! $COOKIE variable had a "slash" in it... it still saved to file but wasn't able to use it.

like image 186
Crazy_Bash Avatar answered Oct 06 '22 02:10

Crazy_Bash