Skip to main content
Participant
April 25, 2007
Question

Login via CFHTTP?

  • April 25, 2007
  • 3 replies
  • 496 views
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?
This topic has been closed for replies.

3 replies

Inspiring
April 26, 2007
Mr Black,
Good call on the headers. I completely forgot about that!
Inspiring
April 25, 2007
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.
Participant
April 25, 2007
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?
Participating Frequently
April 26, 2007
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 CFX_HTTP5, which handles sessions for you.