kevinkhan Posted March 17, 2011 Share Posted March 17, 2011 I have the following code but i can seem to log into the page can somebody tell me what is wrong please <?php error_reporting(E_ALL); $maindir = dirname(__FILE__) . DIRECTORY_SEPARATOR; include($maindir.'functions.php'); set_time_limit(0); ini_set('memory_limit','128M'); $curl_handle = curl_init(); define("SSL_CA_FILE", ".\\temp\\ssl"); define("COOKIE_FILE", "cookies.txt"); $source_file = $maindir.'login_info.txt'; // report errores error_reporting(-1); $maindir.'login_info.txt'; $fp_s = fopen($source_file, 'r'); $ch = curl_init(); //curl_followlocation set the curl to follow the site and get the final web page if the // website has redirects curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)'); // save cookie curl_setopt($ch, CURLOPT_COOKIEJAR, $maindir.'cookie.txt'); // get cookie curl_setopt($ch, CURLOPT_COOKIEFILE, $maindir.'cookie.txt'); // not to print out the results curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $account = '*****'; $password = '*****'; if(file_exists(COOKIE_FILE)) { unlink(COOKIE_FILE); } $qryString = 'email='.urlencode($account).'&pass='.urlencode($password).'&login_type=1'; curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $qryString); curl_setopt($ch, CURLOPT_URL, 'https://secure.gumtree.ie/account/login'); $page = curl_exec($ch); echo $page; // close session curl_close($ch); ?> Link to comment https://forums.phpfreaks.com/topic/230935-php-curl-help-please/ Share on other sites More sharing options...
btherl Posted March 17, 2011 Share Posted March 17, 2011 What happens when you try that code? Link to comment https://forums.phpfreaks.com/topic/230935-php-curl-help-please/#findComment-1188870 Share on other sites More sharing options...
kevinkhan Posted March 18, 2011 Author Share Posted March 18, 2011 What happens when you try that code? nothing happens it just shows the login page account = 42775990 password = kevinkhan use these to test if you can please Link to comment https://forums.phpfreaks.com/topic/230935-php-curl-help-please/#findComment-1189085 Share on other sites More sharing options...
btherl Posted March 20, 2011 Share Posted March 20, 2011 If you haven't got something equivalent, I would recommend using LiveHTTPHeaders in Firefox. It will show you exactly what is sent, so you can replicate it with curl. Link to comment https://forums.phpfreaks.com/topic/230935-php-curl-help-please/#findComment-1190095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.