arkadaşlar bir sayfaya login olmaya çalışıyorum curl ile ama hata veriyor. login formuna geri dönüyor. giriş yapacağım formun kodları bunlar.
<table cellpadding="0" cellspacing="0" align="center"><tr><td valign="top">
<form action="https://www.site.com/m/l/" method="post" style="display:inline" onsubmit="return verenvio(2);" autocomplete="off" id="loginform">
<input type="hidden" name="lge" value="65ABC63868BD65BF1707F899C9773406F2D9CD83B41890ABA143A1843AB2A67C35590DFBEFCDEACC4AB6D08F693A90D1FFEFF7D233C7B456F82B3910BCC996D285FC0F9C8CCB9AE256C6AC1D955E11B5C881EFBDB83E17BFC13B6883608A94282AEFAB335A24FE563C7AACA894069F123152D42227C940E384AA899D1621E664682CF4E9E14FEB49E924D958AE90A32E3C8AA7C74398CB199D2D4DAE04D4A72939B16D151AF084FBADCA08C4D29E58F5D27FD99736A69B21A7CCF87DD4C3CD5951087D440C8C35AE0D88A55CCEF264A592C17C1F5A4E084C82EC7FFB01001BFA0F767F28E63CCCD849C04EB5900CC695888E931501620232C2AAA05819D4307560DE2FB175CEA460B4B21EBD3E97BDD3741B622147DA751BB5DBBC88161AAAF3E88FCDCEF2D4739C5248F69537BE962356BDE8CFA76FB1C83C65933FBB54EC8AD07507FAF10474265E622C61CA76B96E19C6DF8622D8C8C3A3CE45EE97C7CB0C" />
<table cellpadding="0" cellspacing="0" align="center" id="Kf0"><tr>
<td valign="top">
<table cellpadding="1" cellspacing="0"><tr>
<!--USENAME-->
<td class="f_r" align="right" nowrap onclick="tT('Kf1')" style="cursor:pointer;font-size:14px;">Username:&nbsp;</td><td>
<input type="text" name="A80E5602D9320C1AA5B0EDDF33702CF6" id="Kf1" class="campotexto" style="width:155px;font-size:12px;" maxlength="14" onfocus="campo(this.id,14,/^[0-9a-zA-z]+$/)" onKeyUp="campo(this.id,14,/^[0-9a-zA-z]+$/)" onClick="campo(this.id,14,/^[0-9a-zA-z]+$/)" onblur="this.style.backgroundColor=''" placeholder="Username"/></td><td></td></tr>
<!--PASSWOD-->
<tr><td class="f_r" align="right" nowrap onclick="tT('Kf2')" style="cursor:pointer;font-size:14px;">Password:&nbsp;</td>
<td><input type="password" name="ADADE9AF0A5ABC5090077BFC9FD8EB73" id="Kf2" class="campotexto" style="width:155px;font-size:12px;" maxlength="100" onfocus="campo(this.id,100,'')" onKeyUp="campo(this.id,100,'')" onClick="campo(this.id,100,'')" onblur="this.style.backgroundColor=''" placeholder="Password"/></td></tr>
<!--PASSWOD 2-->
<tr><td class="f_r" align="right" nowrap onclick="tT('Kf4')" style="cursor:pointer;font-size:14px;">Secondary Password:&nbsp;</td>
<td><input type="password" name="A60E045DC757E6ED1FE9A2C40D7DBF32" id="Kf4" class="campotexto" style="width:155px;font-size:12px;" maxlength="100" onfocus="campo(this.id,100,'')" onKeyUp="campo(this.id,100,'')" onClick="campo(this.id,100,'')" onblur="this.style.backgroundColor=''" placeholder="Secondary Password"/><br></td></tr>

<input type="hidden" name="AF7750A538012B627DB6AE0CBCDFAD4D" id="Kf3" value="" />
<input type="hidden" name="login" value="1" />
gönder kısmı
<a class="button medium green" onselectstart="return false;" onclick="verenvio(1)" id="botao_login"><span>send</span></a>
onclick verenvio(1) diye javascript eklemiş. java dan anlamam ama kodları bunlar olması lazım
<script>
function verenvio(o){var a1=d00('Kf1').value.length;
					var a2=d00('Kf2').value.length;
					var a3=5;var a4=d00('Kf4').value.length;
					var ax='Kf1';
					if(a1<4||a1>14||a2<4||a2>100||a3!=5||(a4>0&&(a4<4||a4>100)))
						{if(a1<4||a1>14) ax='Kf1';
						else if(a2<4||a2>100) ax='Kf2';
						else if((a4>0&&(a4<4||a4>100))) ax='Kf4';
						else if(a3!=5) ax='Kf3';d00(ax).style.backgroundColor='#fdc';
							d00(ax).focus();return false;}
							else{d00('btl1').style.display='none';
									d00('btl2').style.display='';
									for(a=1;a<5;a++){d00('Kf'+a).style.backgroundColor='';
													d00('Kf'+a).style.color='#aaa';
													d00('Kf'+a).readOnly=true;}
					if(o==1) jQuery('#loginform').submit(); else return true;}}
					jQuery(document).keypress(function(e){if(e.keyCode==13||e.charCode==13){verenvio(1);return false;}});
					campos=['Kf1','Kf2','Kf4','Kf3'],shift=false,clock=false;</script>
form action da yazan url login formu ile aynı. benim kodlarım
<?php
$url="http://www.site.com";
$baglan="https://www.site.com/m/l/";

$cookie_file_path = fopen("cookie.txt","r+"); 
$useragent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";    
        
  
    

$ch = curl_init($url); // oturum baslat
//POST  adresi
curl_setopt($ch, CURLOPT_URL,$baglan);
//curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch , CURLOPT_REFERER , $url);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 

$site= curl_exec ($ch);


$user1= explode('</td><td><input type="text" name="',$site);
$user= explode('"',$user1[1]);

$pass1= explode('Password:&nbsp;</td><td><input type="password" name="',$site);
$pass= explode('"',$pass1[1]);

$pass_2= explode('Secondary Password:&nbsp;</td><td><input type="password" name="',$site);
$pass2= explode('"',$pass_2[1]);

$hidden1= explode('</tr><input type="hidden" name="',$site);
$hidden= explode('"',$hidden1[1]);

$submit1= explode('value="" /><input type="hidden" name="',$site);
$submit= explode('"',$submit1[1]);

$lge1= explode('name="lge" value="',$site);
$lge= explode('"',$lge1[1]);

$login=array(   $user[0]   =>"kullanıcı",
				$pass[0]   =>"şifre",
				$pass2[0]  => "",
				$hidden[0] => "",
				"lge"      =>$lge[0],
				"login"    =>"1"  
				);
				
foreach ( $login as $key => $value) 
{
    $post_items[] = $key.'='.$value;
}
$post_login = implode ('&', $post_items);
echo $post_login."<br>";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_login);
$site1 = curl_exec ($ch);

curl_close ($ch);
if($site1!=true){echo "basarisiz.";}else{
echo $site1;}
?>