Jump to content
Updating IPB tonight Read more... ×


This topic is now archived and is closed to further replies.


A question about curl and "CURLOPT_FOLLOWLOCATION"

Recommended Posts

Ok.. so I have a curl script that auto logs me into my account at chase.com (I use it for tracking my IRA on a daily basis). They recently modified the login process and my script no longer works. Here is the only way to make it work...

Steps 1 and 2 of my code work PERFECT so far

1. Submit the form values to 'formpost.fcc'
I have NO idea what the source does for that page (something with a session and it just redirects me to..

2. sso_logon.jsp?fromLoc=ALL&LOB=COLLogon At this point I am still good.

Here is where my code stops working.
3. On the page mentioned about it has ANOTHER redirect to '/online/logon/on_successful_logon.jsp?LOB=COLLogon'

BUT it is redirecting the page to www.MY URL HERE.com/online/logon/on_successful_logon.jsp?LOB=COLLogon where I want it to redirect to www.chase.com/online/logon/on_successful_logon.jsp?LOB=COLLogon

Any ideas? I can provide the code in here upon request.

Share this post

Link to post
Share on other sites
Do you have at least these two options specified?

curl_setopt($c, CURLOPT_MAXREDIRS, 2);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);

[a href=\"http://us2.php.net/manual/en/function.curl-setopt.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.curl-setopt.php[/a]

Share this post

Link to post
Share on other sites
toplay I am glad you hopped on here. I often have these "out of the norm" problems and you seem to be one of the few that has the answers. Unfortunatley this still does not work. Here is the code I am using now...

######### Prepare curl settings and variables #########
curl_setopt($ch, CURLOPT_URL, "https://chaseonline.chase.com/siteminderagent/forms/formpost.fcc");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_MAXREDIRS, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);

I actually noted that the code that is causing this problem is this which I can see on the 'view source' of the page...

function init()

<!-- document.on_succes_logon.action = "https://pfsonline.chase.com/pfsonline/logon/sso_pfs_logon_welcome.jsp";-->

<!-- document.on_succes_logon.action = "sso_logoff_question.jsp";-->

document.on_succes_logon.action = '/colappmgr/colportal/customer?_nfpb=true&_pageLabel=page_myaccounts';

//document.location.href = document.on_succes_logon.action;
return true;

Share this post

Link to post
Share on other sites
You're missing this:

curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');

The cookie jar is good for the first request which sets the name of the file to store the cookie in. But on subsequent requests, you have to use the cookie file option and point it to the same cookie file so cURL reads the cookies from the file and sends them along with the HTTP request.

Specify both the cookie jar and cookie file at first since you have redirects. But if that doesn't work, then you may have to do it in steps. Like not follow redirects initially.

In case you're running this on a web host and not your local server, remember to save the cookie.txt in a private area (and not accessible to the public like the web folder).

While testing at first, it's probably good to increase CURLOPT_MAXREDIRS to more than 2 for now.

At the end, remember to delete (unlink) the cookie file.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.