djtozz Posted November 24, 2009 Share Posted November 24, 2009 Hello, I'm trying to make a remote login connection using curl for easy-share.com I have follwing code: <?php $query = "login=test98&password=test98&remember=1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://www.easy-share.com/accounts"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$query); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); print $data; ?> I created following test account: user: test98 pass: test 98 The problem is following, I'm probably using the wrong CURLOPT_URL path to login: http://www.easy-share.com/accounts They are poping up the login window on their mainpage using a script. See: http://easy-share.com/ Can somebody advice me how I can solve this? Thanks Link to comment https://forums.phpfreaks.com/topic/182755-curl-remote-login-question/ Share on other sites More sharing options...
djtozz Posted November 25, 2009 Author Share Posted November 25, 2009 Anybody please ? Link to comment https://forums.phpfreaks.com/topic/182755-curl-remote-login-question/#findComment-965677 Share on other sites More sharing options...
abrarazeem Posted November 26, 2009 Share Posted November 26, 2009 you can achieve this by this way also may b this help you <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://www.easy-share.com/accounts/login'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'login=test98&password=test98'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); // SET FILE TO DOWNLOAD curl_setopt($ch, CURLOPT_URL, 'http://www.easy-share.com/accounts'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 2nd REQUEST (FILE DOWNLOAD $content = curl_exec ($ch); //echo $result; curl_close($ch); echo $content; ?> Link to comment https://forums.phpfreaks.com/topic/182755-curl-remote-login-question/#findComment-965935 Share on other sites More sharing options...
djtozz Posted December 5, 2009 Author Share Posted December 5, 2009 may b this help you Thanks a lot amigo! Excactly what I was looking for : - ) Link to comment https://forums.phpfreaks.com/topic/182755-curl-remote-login-question/#findComment-972086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.