glenelkins Posted June 24, 2010 Share Posted June 24, 2010 Hi can anyone see why this code keeps returning the login page, like its not actually posting the form: //init curl and login $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://members.cj.com/member/login" ); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7'); curl_setopt ( $curl, CURLOPT_FAILONERROR, true ); curl_setopt ( $curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt ( $curl, CURLOPT_CONNECTTIMEOUT, 10 ); curl_setopt($curl, CURLOPT_TIMEOUT, 10); curl_setopt ($curl, CURLOPT_COOKIEJAR, "cj.txt"); curl_setopt ($curl, CURLOPT_POST, 1); curl_setopt ($curl, CURLOPT_POSTFIELDS, "uname=email@domain.com&pw=blabla2727"); $return = curl_exec($curl); // close curl curl_close ( $curl ); die ($return); Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted June 24, 2010 Share Posted June 24, 2010 Well first you have to get the page to login right. (You dont submit data to the form, you submit data to the form processor). /member/foundation/memberlogin.do Then you have to mimmick _all_ of the fields... curl_setopt ($curl, CURLOPT_POSTFIELDS, "uname=email@domain.com&pw=blabla2727&go=Go&nextpage="); But notice when you login you have a "jsessionid". So you may need to "Grab" the Login form page first, then add the jsessionid key to the URL you are submitting the data too, example: /member/foundation/memberlogin.do;jsessionid=abc4thPl7eUxtcKGjqQLs -cb- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.