Downloading Web pages that require cookies

Dave Cragg dcragg at
Mon Aug 30 16:43:06 EDT 2004

On 30 Aug 2004, at 17:28, Anthony Craine wrote:
> Is it possible, using Transcript's various URL scripting commands, to
> download Web pages that require cookies in order to be downloaded? Or
> would it make more sense to embed a UNIX curl command within a script 
> in
> Revolution? I know that curl can send cookie info to a Web server to
> retrieve pages; I can't determine if Transcript has a command that can
> do the same.

Yes, it's possible.

When making a url request, you would send the cookie by setting the 
httpHeaders property. I can't remember exactly the format for a cookie 
header, but it's be something like this:

   Cookie: name=value

So you would do something like this (very roughly) in your script:

     put <some name> into tCookieName
     put <some data> into tCookieValue
     set the httpHeaders to "Cookie: " & tCookieName & "=" & tCookieValue
     get url myUrl
     set the httpHeaders to empty

To get the cookie that is sent by the server, you would use 
libUrlLastRHHeaders() and parse the data for the "Set-Cookie" header.


More information about the Use-livecode mailing list