...

View Full Version : php curl help please



kevinkhan
03-17-2011, 07:06 PM
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 = '42775990';
$password = 'kevinkhan';


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);

?>

kevinkhan
03-17-2011, 07:12 PM
i want to get two this page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum