Cfhttp is getting Re-redirected

I am trying to use CFhttp and redirect to a page, but it puts me back to the login area of my wordpress blog.

I get different responses when I try to go two different urls.

URL 1: the admin area of wordpress
URL 2: the login area of wordpress

When I try to use CFhttp to go the admin area... it just shows (redirects to) the login. I want it to cfhttp to the admin area! I am already logged in, so that is not the issue. I also don't think that this is a wordpress issue per se, but it's what I'm working with.

Below are the two different header responses from the two pages:
URL 1: (This does not go where I want it to - it re-redirects to the login page)
HTTP/1.1 200 OK Connection: close Expires: Wed, 11 Jan 1984 05:00:00 GMT Date: Tue, 21 Apr 2009 01:11:49 GMT Server: Apache/2.2.3 (CentOS) Content-Length: 2166 X-Powered-By: PHP/5.1.6 Pragma: no-cache Cache-Control: no-cache, must-revalidate, max-age=0 Set-Cookie: wordpress_test_cookie=WP+Cookie+check; path=/; Last-Modified: Tue, 21 Apr 2009 01:11:50 GMT Content-Type: text/html; charset=UTF-8 
URL 2: (The login area)
HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Connection: close Date: Tue, 21 Apr 2009 01:12:37 GMT X-Pingback: Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6

Open in new window

Who is Participating?
CF server is not you. just because you are logged in to your blog in your browser does not mean CF is logged into there.

i do not use WP, so i do not know what kind of authentication they use or if they provide any API for accessing admin area remotely... but supposedly WP login is a simple form you have to fill in and submit? if so, you may want to try passing your login credentials in <cfhttpparam> tags with cfhttp POST request...

if WP uses cookies to authenticate users and keep them logged in, then it will be a bit trickier as you will need to get that cookie and pass it in your every other cfhttp request...

google cfhttp cookie for some examples how this can be done.
or check these Ben Nadel's blog entries (they come up as #1 and 2 results in google search any way):

monosythAuthor Commented:
This is definitely a cookie and cfhttp problem.

I need to figure out how to get the cookie information and pass it through. When i try it now, it returns this info:

Cookie Name= wordpress_test_cookie
Cookie Value= WP+Cookie+check

These are not real cookie names and values...
that first link i posted explains in great detail how to extract returned cookie info and use it in subsequent cfhttp requests.

monosythAuthor Commented:
It's a bit in depth for me at my expertise level, so it will probably take me a while to figure it out.
Ben's explanation just looks overwhelming - once you start working through the code it is actually pretty straight-forward.
his code samples are always top-notch, and you will probably pick up a few good code habits from there (i know i did!).

just shout if you get stuck or need any help!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.