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, "[email protected]&pw=blabla2727"); $return = curl_exec($curl); // close curl curl_close ( $curl ); die ($return); Link to comment https://forums.phpfreaks.com/topic/205719-curl-login-not-working-wtf/ 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, "[email protected]&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- Link to comment https://forums.phpfreaks.com/topic/205719-curl-login-not-working-wtf/#findComment-1076646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.