Merhabalar forumda pek cok kez bu konunun gectigini gordum ve 3 gundur bu konu uzerinde calisiyorum. Sonucta assagida birseyler cikardim fakat isin icinden tam olarak cikamadim suanda sorunum sayfaya login olamamak. sayfanin ciktisi oldugu gibi karsima cikiyor. Giris formu oldugu gibi karsimda.
Aslinda isteğim sayfaya login olmak ve sayfaya bagli uyelik girisi gerektiren herhangibir linkten verileri çekmek fakat login olamadigim icin devamını getiremedim. Umarim bir cozum buluruz simdiden herkese tesekkurler.
<?php
#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("#<input type=\"hidden\" name=\"guvenlik\" size=\"18\" value=\"(.*?)\">#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);
?>Ayrica firefox live http headers eklentisin'den aldigim bilgiler de burada
POST /kontrol.asp HTTP/1.1
Host: www.xxxxx.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: tr-TR,tr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-9,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.xxxx.com/Giris.asp
Cookie: __utma=195605934.1737354951.1207944045.1207944045.1208049565.2; __utmz=195605934.1207944045.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); zzzxccx=bayikodu=02%2D%DEB0005; ASPSESSIONIDCQATRBTC=FPEJAGEAMKMJMGOHAKFKFAFM; __utmb=195605934.1.10.1208049565171; __utmc=195605934
Content-Type: application/x-www-form-urlencoded
Content-Length: 105
guvenlik=d8f20c3860029b7b4a98112dcde44b52&bayikodu=02-%DEB0005&kullaniciadi=kullanici&sifre=123456&B1=Giri%FE