Curl İle Login Sorunu
-
Selam,
Okul için basit bir sistem geliştiriyorum, lakin okulun bilgi yönetim sistemine bir türlü bağlanamadım. Lisans'ı da eklememe rağmen cURL ile girişi sağlayamadım. Koddan kısaca bahsedeyim; bys login.aspx dosyasına login olduktan sonra dashboard.aspx'e atlamak istiyorum. Yazdığım kod hemen aşağıda, şimdiden teşekkürler.
$url = "https://bys.marmara.edu.tr/login.aspx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,'txtLogin='.urlencode($username).'&txtPassword='.urlenco de($password));
//curl_setopt($ch, CURLOPT_POSTFIELDS,'txtLogin='.$username.'&txtPassword='.$password);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CAINFO, "./bys-license.crt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_exec($ch);
curl_close($ch);$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, 'http://bys.marmara.edu.tr/dashboard.aspx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch); -
cookiejar kısmı ilk kurduğun bağlantıda olucak cookiefile kısmını sil onu 2. bağlantıya ekle