Curl ile Login olma yardım. |
5 Mesajlar | 2.019 Okunma | ||
#OTURUM BASLIYOR
$ch=curl_init('http://www.xxx.com/kontrol.asp');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$source=curl_exec ($ch);
#SISTEME BAGLANTI SONRASI GUVENLIK INPUT BILGISI ALINIYOR (SESSIONID)
preg_match("##i",$source,$deger);
$gonderi= "guvenlik=$session&bayikodu=$bk&kullaniciadi=$kadi&sifre=$key&B1=$gir";
#TARAYICI VE SISTEME GIRIS BILGILERI TANIMLANIYOR
$useragent= "Opera/9.21 (Windows NT 5.1; U; tr)";
$session= urlencode($deger[1]);
$bk= urlencode("02-ŞB0005"); // bayi kodu
$kadi= urlencode("kullanici"); // kullanici adi
$key= urlencode("123456"); // sifre
$gir= urlencode("Giriş"); // formdaki submit butonun adı
$cookie= "/path/cookie.txt";
#OTURUMA SISTEME GIRIS BILGILERI GONDERILIYOR
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $gonderi);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
$source=curl_exec ($ch);
#SAYFANIN CIKTISI ALINIYOR
echo $source;
#OTURUM KAPATILIYOR
curl_close ($ch);
?>