I want to creat a weblogin client using php to login to this forum or someother.
but i am gating with the page that u have to login befor precede.
I am new to curl so cannot figure out where the problem is.
[PHP]
<?php
$usrname="xxxxxx";
$password="xxxxxxx";
$loginURL="http://www.thescripts.com/forum/login.php?do=showlogin";
$reffer="http://www.thescripts.com/forum/usercp.php?";
$cookiepath="/tmp/cookielog";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiepath);
curl_setopt($ch, CURLOPT_URL,$loginURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,'vb_login_usern ame='.$usrname.'&vb_login_password='.$password);
ob_start();
curl_exec($ch);
ob_end_clean();
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiepath);
curl_setopt($ch, CURLOPT_URL,$reffer);
$result = curl_exec ($ch);
print $result;
curl_exec($ch);
curl_close ($ch);
?>
[/PHP]