Herb Martin
5/1/2008 9:48:00 AM
"Fred" <nospam@gmail.com> wrote in message
news:481601aa$0$21692$8a7afdce@news4.usenet4u.nl...
> Roger Pack schreef:
>> curl allows you to save cookies to a file then reload them, if that's
>> useful.
>> What exactly are you trying to accomplish?
>>
>>>> Google: [ ruby libcurl ]
>>
>
> Hi,
>
> In the cookies file, i have my settings to connect to an site.
>
> User, password, cid and sid.
> The problem is the sid, that change everytime depending if i have
> connected again or closed the browser.
Presuming that "sid" is a Session ID from the site -- but more importantly
it is a COOKIE being saved by a normal browser and you need to
access the site programmatically from Ruby.
I use Curl (LibCurl really) from PHP regularly, but IF you can get the
libraries to work with Ruby (at all) then it should work similarly.
By setting options, one can get LibCurl to autosave and autouse the
cookies to/from a file thus making it work pretty much like an
ordinary browser but from within a programming language (e.g., Php
or maybe Ruby.)
> Is it possible to programs something dynamically, so that in my rb file
> the sid is picked up automatically?
Yes. You could also use libcurl and just extract the cookies yourself
if you know what their names are or a pattern to pick them up, then
set them manually, but using the autosave (to file) feature is much
less trouble.
> For instance i'm connected to this site through my ruby program.
> Now if i log in on an other computer my ruby programs fail, because the
> sid is not correct anymore.
Why you would be using "an other computer" is not explained here, but
if you export the Sid-cookie to a file you could make it available on
another machine (if you move it there.)