• 27-01-2016, 17:19:46
    #1
    Merhaba Arkadaşlar,
    Tdk dan veri çekmeye çalışıyorum ama denemelerim başarısız oldu. Acaba nerede hata yapıyorum?

    <?php 
    
    $data = array( 
            'kelime' => 'deneme',  
            'gonder' => 'ARA',
            'ayn' => 'tam',
        );
    
    $url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)';
    $referer = 'http://www.google.com/'; 
    $ch = curl_init(); 
    $zaman = 0; 
    curl_setopt ($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_POSTS, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman); 
    curl_setopt ($ch, CURLOPT_REFERER, $referer); 
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent); 
    $sonuc = curl_exec($ch); 
    curl_close($ch); 
    echo $sonuc; 
    
    
    
    
    ?>
  • 27-01-2016, 19:50:54
    #2
    CURLOPT_POSTS yerine CURLOPT_POST olacak.
  • 27-01-2016, 20:18:12
    #3
    trflash adlı üyeden alıntı: mesajı görüntüle
    CURLOPT_POSTS yerine CURLOPT_POST olacak.
    Teşekkür ederim cevabınız için ama çalışmadı...
  • 27-01-2016, 21:58:05
    #4
    lenfom adlı üyeden alıntı: mesajı görüntüle
    Merhaba Arkadaşlar,
    Tdk dan veri çekmeye çalışıyorum ama denemelerim başarısız oldu. Acaba nerede hata yapıyorum?

    <?php 
    
    $data = array( 
            'kelime' => 'deneme',  
            'gonder' => 'ARA',
            'ayn' => 'tam',
        );
    
    $url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)';
    $referer = 'http://www.google.com/'; 
    $ch = curl_init(); 
    $zaman = 0; 
    curl_setopt ($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_POSTS, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman); 
    curl_setopt ($ch, CURLOPT_REFERER, $referer); 
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent); 
    $sonuc = curl_exec($ch); 
    curl_close($ch); 
    echo $sonuc; 
    
    
    
    
    ?>
    Bir de bu şekilde deneyin ;

    $data = array(  
            'kelime' => 'deneme'
        ); 
    
    //$url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime"; 
    $url = "http://tdk.gov.tr/index.php?option=com_gts&arama=gts";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)'; 
    $referer = 'http://www.google.com/';  
    $ch = curl_init();  
    curl_setopt ($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);  
    curl_setopt ($ch, CURLOPT_REFERER, $referer);  
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);  
    $sonuc = curl_exec($ch);  
    curl_close($ch);  
    
    echo $sonuc ;
  • 27-01-2016, 23:54:04
    #5
    ydlgr adlı üyeden alıntı: mesajı görüntüle
    Bir de bu şekilde deneyin ;

    $data = array(  
            'kelime' => 'deneme'
        ); 
    
    //$url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime"; 
    $url = "http://tdk.gov.tr/index.php?option=com_gts&arama=gts";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)'; 
    $referer = 'http://www.google.com/';  
    $ch = curl_init();  
    curl_setopt ($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);  
    curl_setopt ($ch, CURLOPT_REFERER, $referer);  
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);  
    $sonuc = curl_exec($ch);  
    curl_close($ch);  
    
    echo $sonuc ;
    Sizede cevabınız için teşekkür ederim. Lakin ben büyük türkçe sözlük (bts) üzerinde arama yapmak istiyorum siz güncel türkçe sözlük (gts) üzerinden sorguyu döndürmüşsünüz...
  • 28-01-2016, 00:35:16
    #6
    lenfom adlı üyeden alıntı: mesajı görüntüle
    Sizede cevabınız için teşekkür ederim. Lakin ben büyük türkçe sözlük (bts) üzerinde arama yapmak istiyorum siz güncel türkçe sözlük (gts) üzerinden sorguyu döndürmüşsünüz...
    Buyrun gerekli düzenlemeyi yaptım ;

    $data = array(  
            'kelime' => 'deneme',
            'ayn' => 'tam',
            'kategori' => 'verilst'
    
        ); 
    
    //$url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime"; 
    $url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)'; 
    $referer = 'http://www.google.com/';  
    $ch = curl_init();  
    curl_setopt ($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);  
    curl_setopt ($ch, CURLOPT_REFERER, $referer);  
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);  
    $sonuc = curl_exec($ch);  
    curl_close($ch);  
    
    echo $sonuc ;
  • 28-01-2016, 19:19:49
    #8
    ydlgr adlı üyeden alıntı: mesajı görüntüle
    Buyrun gerekli düzenlemeyi yaptım ;

    $data = array(  
            'kelime' => 'deneme',
            'ayn' => 'tam',
            'kategori' => 'verilst'
    
        ); 
    
    //$url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime"; 
    $url = "http://tdk.gov.tr/index.php?option=com_bts&arama=kelime";
    
    $useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html)'; 
    $referer = 'http://www.google.com/';  
    $ch = curl_init();  
    curl_setopt ($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);  
    curl_setopt ($ch, CURLOPT_REFERER, $referer);  
    curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);  
    $sonuc = curl_exec($ch);  
    curl_close($ch);  
    
    echo $sonuc ;



    ikinizede çok teşekkür ederim...