Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

HTTPClient and session handle or cookie save in file?

Hi,

Im wondered how are you doing session handle in HTTPClient requests?

I mean, for example we need make 2 requests like:

  1. Login to page, and store cookies
  2. Get data from another page

I tried find any idea how to do that, but nothing..
so maybe here you can share with your ideas?
maybe i should request as new feature in titanium? would be great if developers will code it asap, like saving cookies to a temp file, and in another request just read cookie file.. like cURL in PHP does..

— asked July 8th 2010 by Michal G
  • cookies
  • httpclient
  • session
0 Comments

5 Answers

  • You can manually grab the cookies from the response headers - "Set-Cookie" is the name of the header - then resend those cookies with the request if need be.

    — answered July 8th 2010 by Kevin Whinnery
    permalink
    2 Comments
    • unfortunatly this will not always work!

      If the login page redirects to a other page titanium got a bug… but I got a fix for it!

      This fix is not in the source code of titanium…. a wanna share this fix for ASIHTTPRequest.m
      but I don´t know how to?

      — commented November 17th 2010 by Marc Bender
    • Has this been resolved?

      — commented April 4th 2011 by Andrew Cove
  • I'm working on a cookie respecting client.

    http://www.tine20.org/forum/viewtopic.php?f=12&t=4608&p=18980#p18980

    — answered November 16th 2010 by Kay Strobach
    permalink
    0 Comments
  • Has anyone got any code example of how to do this?

    — answered November 16th 2010 by Eamonn Hynes
    permalink
    0 Comments
  • Has anyone got any code example of how to do this?

    — answered November 16th 2010 by Eamonn Hynes
    permalink
    1 Comment
    • get the cookie from the header and then set the cookie on the next request?

      — commented November 16th 2010 by Aaron Saunders
  • Hi,
    Im wondered how are you doing session handle in HTTPClient requests?
    I mean, for example we need make 2 requests like: 1. Login to page, and store cookies 2. Get data from another page

    — answered January 31st 2012 by Haagii Nyamsuren
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.