Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

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=/; domain=.mywebsite.com 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: http://blogname.mywebsite.com/xmlrpc.php Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6

Open in new window

0
monosyth
Asked:
monosyth
  • 3
  • 2
1 Solution
 
azadisaryevCommented:
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):
http://www.bennadel.com/blog/725-Maintaining-Sessions-Across-Multiple-ColdFusion-CFHttp-Requests.htm
http://www.bennadel.com/blog/1171-CFHTTPSession-cfc-For-Multi-CFHttp-Requests-With-Maintained-Session.htm

Azadi
0
 
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...
0
 
azadisaryevCommented:
that first link i posted explains in great detail how to extract returned cookie info and use it in subsequent cfhttp requests.

Azadi
0
 
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.
0
 
azadisaryevCommented:
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!

Azadi
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now