• 10-02-2009, 23:28:33
    #37
    Üyeliği durduruldu
    $ch   = curl_init('https://www.bayinet.com.tr/bayi/security/loginrespond.asp');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $icerik = curl_exec ($ch);
    curl_close ($ch);
    şeklinde sayfa içeriğinin icerik adlı değişkende tutulmasını sağlarsın. eğer başarısız olursa FALSE değeri döner.

    if ($icerik === FALSE) {
    echo "bağlantı sorunu var";
    } else {
    echo $icerik;
    }
    bu kodla; sorun oluşursa hata mesajı basılır, sorun yoksa içerik basılır ekrana. kendine göre düzenlersin. istersen hiç birşey de yazdırmayabilirsin. sana kalmış.
  • 10-02-2009, 23:54:43
    #38
    Alıntı
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    eklediğimde xml dosyasını iki defa yazıyor normal boyu 1.4 mb iken 2.8 mblık bir dosya oluşturuyor.
    <?
    set_time_limit(0);
    $data = "kod=xxx&kkod=xxx&sifre=xxx" ; 
    $ch   = curl_init('https://www.bayinet.com.tr/bayi/security/loginrespond.asp');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_exec ($ch);
    curl_close ($ch);
    $ch   = curl_init('https://www.bayinet.com.tr/bayi/security/loginrespond.asp');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_URL, 'http://www.bayinet.com.tr/bayi/liste_genel_xml.asp');
    ob_start();
    curl_exec($ch);
    $resultxml = ob_get_contents();
    ob_clean();
    curl_close ($ch);
    $dosya = 'http://www.bayinet.com.tr/bayi/liste_genel_xml.asp';
    $yenidosya = getcwd().'/genelliste.xml';
    $handle = fopen($yenidosya,'a+');
    fwrite($handle,$resultxml);
    echo 'XML dosyası başarılı bir şekilde oluşturuldu...';
    fclose($handle);
    ?>
  • 11-02-2009, 00:01:08
    #39
    Üyeliği durduruldu
    ob_start();
    curl_exec($ch);
    $resultxml = ob_get_contents();
    ob_clean();

    kısmı yerine


    $resultxml = curl_exec($ch);
    kullanıp dene bir de.
  • 11-02-2009, 00:22:21
    #40
    @MC_delta_T Yardımların için çok teşekür ederim.
    $handle = fopen($yenidosya,'a+');
    bunu
    $handle = fopen($yenidosya,'w+');
    olarak değiştirdim şimdi üstüne yazmıyor. penta arena vs. entegrasyonu kullanacak arkadaşların işine yarayacaktır.
  • 13-02-2009, 02:57:21
    #41
    Üyeliği durduruldu
    Teşekkürler kardeş işime yaradı
  • 14-02-2009, 00:11:56
    #42
    Kendi localhostumdan post atmaya çalışıyorum fakat daha önce curl ile hiç uğraşmadığım için cookilerde sorun yaşadım. Post atmadan önce özel mesaj atarak test etmek istedim. Sorun şu; Siteye login oluyor, ileti gönderme sayfasına gidiyor, iletiyi yazıyor, mesajı gönder butonuna basıyor fakat "Oturumunuz sonlandı lütfen giriş yapın" hatasını veriyor. Yani sorun cookilerde. Kodlar şu şekil;

    giris.php
    <?php
    
    // giris.php
    
    $url = "http://www.xxx.com/forum/login2/";
    $postfields = "user=xxx&passwrd=xxx&cookieneverexp=on";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "C:\wamp\www\cookie.txt");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);
    curl_close($ch);  
    ?>
    msj.php

    // msj.php
    
    <?php
    $url = "http://www.xxx.com/forum/pm/?sa=send2";
    $post = "to=reptile&subject=Test&message=deneme&Submit=Mesaj%20Gönder";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\wamp\www\cookie.txt");
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $out = curl_exec($ch);
    curl_close($ch);  
    ?>
    yardımcı olabilecek arkadaşlara teşekkürler.
  • 14-02-2009, 18:25:28
    #43
    Üyeliği durduruldu
    mesaj atmaya çalıştığın forumun türü ve sürümü ne?
  • 14-02-2009, 20:06:35
    #44
    Smf 1.1.8
  • 14-02-2009, 20:14:41
    #45
    Üyeliği durduruldu
    reptile adlı üyeden alıntı: mesajı görüntüle
    Smf 1.1.8
    verilerin post edildiği yani smf nin mesaj yazma sayfasını dikkatli inceleyin. sadece sizin yazdığınız değişkenler post edilmiyor. hidden tipinde alanlarda var.