curl-users
Re: COOKIES EXPIRES AFTER CERTAIN TIME
Date: Tue, 3 Jul 2007 13:36:19 -0500
On 7/3/07, siddharth <sidd_at_americanmicrosemi.com> wrote:
>
> RIGHT NOW EVERYTIME WHEN THE COOKIES EXPIRE I HAVE TO RELOGIN MANUALLY GRAB
> THE COOKIES FROM HTTPLIVEHEADER AND USE IT. I WAS JUST THINK TO AUTOMATE
> THIS PROCESS.
>
> ANY SUGGESTIONS???
So why not automate the process?? Write a script that uses curl to
grab the login page, extract the login form, use curl to post it back,
then go get the file you're trying to download.
How often are you downloading a file?? If it's just a few times a
day, or even a couple of times per hour, you can simplify the process
by deleting the stored cookies and starting fresh each time. That
takes out the guesswork about being logged in. Something like this:
rm -f cookies
curl -b cookies -c cookies -L -s -S -o login_page.html
http://some.server.com/loginpage
[extract the login details]
curl -b cookies -c cookies -L -s -S -o nextpage.html -d xxx -d
xxx -d xxx [url]
so now you're logged in - go get the file
curl -b cookies -c cookies -L -s -S -o myfile
http://some.server.com/url/to/myfile
etc...
Ralph Mitchell
Received on 2007-07-03