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="xxxxx x";
$password="xxxx xxx";
$loginURL="http ://www.thescripts. com/forum/login.php?do=sh owlogin";
$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_COOKIEJ AR, $cookiepath);
curl_setopt($ch , CURLOPT_URL,$lo ginURL);
curl_setopt($ch , CURLOPT_USERAGE NT, $agent);
curl_setopt($ch ,CURLOPT_POST,1 );
curl_setopt($ch ,CURLOPT_POSTFI ELDS,'vb_login_ username='.$usr name.'&vb_login _password='.$pa ssword);
ob_start();
curl_exec($ch);
ob_end_clean();
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ch , CURLOPT_COOKIEF ILE, $cookiepath);
curl_setopt($ch , CURLOPT_URL,$re ffer);
$result = curl_exec ($ch);
print $result;
curl_exec($ch);
curl_close ($ch);
?>
[/PHP]
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="xxxxx x";
$password="xxxx xxx";
$loginURL="http ://www.thescripts. com/forum/login.php?do=sh owlogin";
$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_COOKIEJ AR, $cookiepath);
curl_setopt($ch , CURLOPT_URL,$lo ginURL);
curl_setopt($ch , CURLOPT_USERAGE NT, $agent);
curl_setopt($ch ,CURLOPT_POST,1 );
curl_setopt($ch ,CURLOPT_POSTFI ELDS,'vb_login_ username='.$usr name.'&vb_login _password='.$pa ssword);
ob_start();
curl_exec($ch);
ob_end_clean();
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ch , CURLOPT_COOKIEF ILE, $cookiepath);
curl_setopt($ch , CURLOPT_URL,$re ffer);
$result = curl_exec ($ch);
print $result;
curl_exec($ch);
curl_close ($ch);
?>
[/PHP]
Comment