• 10-12-2013, 13:56:12
    #1
    Üyeliği durduruldu
    $kullanici_kodu = $_POST['usercode'];
    $kullanici_adi = $_POST['username'];
    $sifre = $_POST['pass'];
    $sayfa="http://abone.iha.com.tr/yeniabone/Login.aspx";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$sayfa);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,"__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=/wEPDwUKMTkxMTA2ODM3Ng9kFgICAw9kFggCAw8PFgIeBFRleHQFHklQIE51bWFyYW7EsXogOiA4OC4yNDAuMTU4LjEzOGRkAgcPEGRkFgECAWQCCQ8WAh4HVmlzaWJsZWgWAmYPZBYEAgMPDxYCHwAFCW9sYXl0YWtpcGRkAhEPDxYEHwAFRkJveWxlIGJpciBJUCBhZHJlc2kgc2lzdGVtZGUga2F5aXRsaSBkZWdpbC5JUCBpbGUgZ2lyacWfIHlhcMSxbGFtYWTEsS4fAWdkZAILDxYCHwFnFgJmD2QWAgIZDw8WBB8ABUZCb3lsZSBiaXIgSVAgYWRyZXNpIHNpc3RlbWRlIGtheWl0bGkgZGVnaWwuSVAgaWxlIGdpcmnFnyB5YXDEsWxhbWFkxLEuHwFnZGRkvZSP7c0HpeowODMzsHcCgSMYF80=&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0&__EVENTVALIDATION=/wEWCgLV48CrAgLT3MG6AwLM3MG6AwLDs+vUDwKSsJLeDALjqqICAo7f/eoNApyy+qQKAoWayroIAsqZvbMHQhWUVN7dh1zeclj2RuxYxtxbyiw=&rblLoginType=1&textboxKullaniciKodu=$kullanici_kodu&KullaniciAdi=$kullanici_adi&textboxKullaniciSifre=$sifre&buttonOKManualLogin=Giriş Yap");
    $data=curl_exec($ch);
    curl_close($ch);
    Sorun Kodumun Neresinde Acaba Bir Türlü Login Olamadım

    Sonuç

    Object moved to here.

    yardımcı olabilirmisiniz lütfen şimdiden teşekkürler
  • 10-12-2013, 14:01:25
    #2
    Şu kod bana asp.net ile hazırlanmış bir sayfaya login olmamda çok yardımcı olmuştu. Kod ve kaynak linkini buraya ekliyorum.

    Link: http://stackoverflow.com/questions/1...ite-using-curl


    <?php
    $url = "http://www.kalahari.com/marketplace/default.aspx";
    $ckfile = tempnam("/tmp", "CURLCOOKIE");
    $useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2';
    
    $username = "XXXXXXXXXX";
    $password = "XXXXXXXXXX";
    
    
    $f = fopen('log.txt', 'w'); // file to write request header for debug purpose
    
    /**
        Get __VIEWSTATE & __EVENTVALIDATION
     */
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    
    $html = curl_exec($ch);
    
    curl_close($ch);
    
    preg_match('~<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" />~', $html, $viewstate);
    preg_match('~<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" />~', $html, $eventValidation);
    
    $viewstate = $viewstate[1];
    $eventValidation = $eventValidation[1];
    
    
    
    /**
     Start Login process
     */
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_REFERER, $url);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_STDERR, $f);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    
    // Collecting all POST fields
    $postfields = array();
    $postfields['__EVENTTARGET'] = "";
    $postfields['__EVENTARGUMENT'] = "";
    $postfields['__VIEWSTATE'] = $viewstate;
    $postfields['__EVENTVALIDATION'] = $eventValidation;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInEmail'] = $username;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInPasswordTextNormal'] = "Password";
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInPassword'] = $password;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$btnSigninTop'] = 'Sign in';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$txtEmail'] = 'Email address';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$rdlPasswordYes'] = 'Password';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$txtPassword'] = '';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$hdnEmailDefault'] = 'Email address';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$hdnPasswordDefault'] = 'Password';
    
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    $ret = curl_exec($ch); // Get result after login page.
    
    print $ret;
    ?>
  • 10-12-2013, 14:04:45
    #3
    Üyeliği durduruldu
    mtn adlı üyeden alıntı: mesajı görüntüle
    Şu kod bana asp.net ile hazırlanmış bir sayfaya login olmamda çok yardımcı olmuştu. Kod ve kaynak linkini buraya ekliyorum.

    Link: http://stackoverflow.com/questions/1...ite-using-curl


    <?php
    $url = "http://www.kalahari.com/marketplace/default.aspx";
    $ckfile = tempnam("/tmp", "CURLCOOKIE");
    $useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2';
    
    $username = "XXXXXXXXXX";
    $password = "XXXXXXXXXX";
    
    
    $f = fopen('log.txt', 'w'); // file to write request header for debug purpose
    
    /**
        Get __VIEWSTATE & __EVENTVALIDATION
     */
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    
    $html = curl_exec($ch);
    
    curl_close($ch);
    
    preg_match('~<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" />~', $html, $viewstate);
    preg_match('~<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" />~', $html, $eventValidation);
    
    $viewstate = $viewstate[1];
    $eventValidation = $eventValidation[1];
    
    
    
    /**
     Start Login process
     */
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_REFERER, $url);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_STDERR, $f);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    
    // Collecting all POST fields
    $postfields = array();
    $postfields['__EVENTTARGET'] = "";
    $postfields['__EVENTARGUMENT'] = "";
    $postfields['__VIEWSTATE'] = $viewstate;
    $postfields['__EVENTVALIDATION'] = $eventValidation;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInEmail'] = $username;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInPasswordTextNormal'] = "Password";
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$txtMPTopSignInPassword'] = $password;
    $postfields['ctl00$ctl00$ucMarketPlaceSupportNavigation$btnSigninTop'] = 'Sign in';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$txtEmail'] = 'Email address';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$rdlPasswordYes'] = 'Password';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$txtPassword'] = '';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$hdnEmailDefault'] = 'Email address';
    $postfields['ctl00$ctl00$cplhMain$cplhContent$hdnPasswordDefault'] = 'Password';
    
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    $ret = curl_exec($ch); // Get result after login page.
    
    print $ret;
    ?>
    deneyecegim hocam teşekkürler
  • 10-12-2013, 14:11:07
    #4
    @Sample,

    Aslında giriş işlemi başarılı "Object moved to here" dan kastı. İlgili kategori sayfasına girerseniz verileri çekecektir büyük ihtimal.

    Ama çerez ( cookie ) tanımlı gidin yoksa giriş yapmamış gibi görmesi yüksek ihtimal
  • 10-12-2013, 14:21:02
    #5
    Followlocation true belirleyerek deneyin yonlendirme oldugu icin o bilgiyi aliyorsunuz.
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
    Telefondan yazdim hata olabilir

    Note 2mden gönderdim
  • 10-12-2013, 14:33:08
    #6
    Üyeliği durduruldu
    YuqseLX adlı üyeden alıntı: mesajı görüntüle
    Followlocation true belirleyerek deneyin yonlendirme oldugu icin o bilgiyi aliyorsunuz.
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
    Telefondan yazdim hata olabilir

    Note 2mden gönderdim
    teşekkürler hocam

    bilgi için login başka yerde deniyorum login oluyor burada böyle cıkınca kaldım öyle


    bir deneyeyim bakalım.

    veri çekeyim bir yerinden gelecekmi bir kontrol edeyim
  • 10-12-2013, 14:34:35
    #7
    Bi deneyin bakalim olmazsa tekrar bakarix

    Note 2mden gönderdim
  • 10-12-2013, 14:57:43
    #8
    Üyeliği durduruldu
    YuqseLX adlı üyeden alıntı: mesajı görüntüle
    Bi deneyin bakalim olmazsa tekrar bakarix

    Note 2mden gönderdim
    <? 
    $kullanici_kodu = $_POST['usercode'];
    $kullanici_adi = $_POST['username'];
    $sifre = $_POST['pass'];
    $sayfa="http://abone.iha.com.tr/yeniabone/Login.aspx";
    $ch = curl_init();
    if (!$ch) { die ("Curl oturumu baslatamadim.."); }
    curl_setopt($ch, CURLOPT_URL,$sayfa); 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,"__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=/wEPDwUKMTkxMTA2ODM3Ng9kFgICAw9kFggCAw8PFgIeBFRleHQFHklQIE51bWFyYW7EsXogOiA4OC4yNDAuMTU4LjEzOGRkAgcPEGRkFgECAWQCCQ8WAh4HVmlzaWJsZWgWAmYPZBYEAgMPDxYCHwAFCW9sYXl0YWtpcGRkAhEPDxYEHwAFRkJveWxlIGJpciBJUCBhZHJlc2kgc2lzdGVtZGUga2F5aXRsaSBkZWdpbC5JUCBpbGUgZ2lyacWfIHlhcMSxbGFtYWTEsS4fAWdkZAILDxYCHwFnFgJmD2QWAgIZDw8WBB8ABUZCb3lsZSBiaXIgSVAgYWRyZXNpIHNpc3RlbWRlIGtheWl0bGkgZGVnaWwuSVAgaWxlIGdpcmnFnyB5YXDEsWxhbWFkxLEuHwFnZGRkvZSP7c0HpeowODMzsHcCgSMYF80=&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0&__EVENTVALIDATION=/wEWCgLV48CrAgLT3MG6AwLM3MG6AwLDs+vUDwKSsJLeDALjqqICAo7f/eoNApyy+qQKAoWayroIAsqZvbMHQhWUVN7dh1zeclj2RuxYxtxbyiw=&rblLoginType=1&textboxKullaniciKodu=$kullanici_kodu&KullaniciAdi=$kullanici_adi&textboxKullaniciSifre=$sifre&buttonOKManualLogin=Giriş Yap");
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
    $user_agent = "Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.19) Gecko/20080528 Epiphany/2.22"; 
    curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
    $data = curl_exec($ch); 
    curl_close($ch);  
    
    ?>
    
    <?
    function CurlFunc($url)
    {if (!extension_loaded(curl))
    {
    die("Extension yuklu degil socket deneyebilirsin");
    }
    $ch = curl_init();
    if (!$ch) { die ("Curl oturumu baslatamadim.."); }
    curl_setopt($ch, CURLOPT_URL,$url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    //curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
    $user_agent = "Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.19) Gecko/20080528 Epiphany/2.22"; 
    curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
    $data = curl_exec($ch); 
    curl_close($ch);  
    return $data;
    }
    $site=CurlFunc("http://abone.iha.com.tr/yeniabone/RSS2.aspx?Kategori=0&Sehir=1"); // Alinacak Siteyi Belirliyoruz.
     
    preg_match_all('#<title>(.*?)</title>#si',$site,$bilgi,PREG_SET_ORDER); 
    // Preg_match_all Alinacak heryeri belirliyruz benzerlerini tabi
    $say=count($bilgi); 				// Burda ise preg_match_all icinden gelen kactane veri varsa onlari sayi degerini veriyor.
    for($i=1; $i<10; $i++){ 			 // Burda ise her preg_match_all deki verilerin araliklarini alir ve ekrana yazdiri yada sql'a yazdirirsin
    $haberbaslik=$bilgi[$i][1];
    
    print $haberbaslik;
    
    }
    ?>

    hocam kodumu şu şekilde düzelttim hata gitti giriş sayfasını ekrana basıyor.

    loginden sonraki bir url den veri çekeyim diyorum hata da yok tepkide.

    sadece ekrana login sayfasını basıyor.
    komple
  • 10-12-2013, 14:59:48
    #9
    Cookieleri kayit etmemissiniz sanirim telefondan cok iyi gozukmuyor. Curl ile cookie olayini arastirin derim zira yazmam cok zor

    Note 2mden gönderdim