I making a bot for remote server login system.For this,I coding something,
sample.php
<?php
$EMAIL = "***";
$PASSWORD = "***";
function cURL($url, $header=NULL, $cookie, $p=NULL)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
if ($p) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
}
$result = curl_exec($ch);
if ($result) {
return $result;
} else {
return curl_error($ch);
}
curl_close($ch);
}
$a = cURL("http://forum.donanimhaber.com/login2.asp",true,null,"Login=$EMAIL&password=$PASSWORD");
preg_match('%Set-Cookie: ([^;]+);%',$a,$b);
$c = cURL("http://forum.donanimhaber.com/login2.asp",true,$b[1],"Login=$EMAIL&password=$PASSWORD");
preg_match_all('%Set-Cookie: ([^;]+);%',$c,$d);
for($i=0;$i<count($d[0]);$i++)
$cookie.=$d[1][$i].";";
echo cURL("forum.donanimhaber.com",null,$cookie,null);
?>
I use this code www.myhost.com/sample.php...Login is successfull.But I am not redirecting forum.donanimhaber.com...In forum.donanimhaber.com,When I click on any link my browser redirect myhost.com/link.php and appear empty page.Normally required to be forum.donanimhaber.com/link.php...