Hi,
We are making a automated script perform some "clean up" duties on our site, but it requires us to "log in" via a <form>. What is the best way to login and create a session?
Oliver Cookson - 25 Apr 2007 17:55 GMT
Our system is creating a cookie which stores the session details so when the next CFHTTP command is performed it isn't viewed as "logged in". How can I get the CFHTTP to store the session?
Mr Black - 26 Apr 2007 17:13 GMT
You have to parse and store Set-Cookie header on the first response (and,
perhaps, on subsequent responses, dependently on your session implementation).
After that you should provide Cookie header within your chain of requests.
Alternatively, you can use http://www.cftagstore.com/tags/cfxhttp5.cfm, which
handles sessions for you.
insuractive - 25 Apr 2007 21:18 GMT
I'm not sure you can. Because the CFHTTP user agent doesn't store cookies,
there is no way to maintain session state. At least as of MX 6.1. You may
want to consider placing your clean up script outside of your login, or at
least change it so that the login validation and clean up occur on the same
page for this particular process.
insuractive - 26 Apr 2007 21:01 GMT
Mr Black,
Good call on the headers. I completely forgot about that!