• 28-04-2017, 18:25:57
    #1
    Üyeliği durduruldu
    function GoogleBot($url)
    {
    
        $header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
        $header[] = 'Cache-Control: max-age=0';
        $header[] = 'Connection: keep-alive';
        $header[] = 'Keep-Alive: 300';
        $header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
        $header[] = 'Accept-Language: en-us,en;q=0.5';
        $header[] = 'Pragma:';
        
        
        
        $curl = curl_init();    
        curl_setopt($curl, CURLOPT_URL, $url);
       // curl_setopt($curl, CURLOPT_PORT, 7001);
        // curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
        curl_setopt ($curl,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
        curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
        curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
        curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0);
        $proxy ='89.55.55.55:80';
        curl_setopt($curl, CURLOPT_PROXY, $proxy);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_VERBOSE,true);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $body = curl_exec($curl);
        curl_close($curl);
        //debug
      //  error_reporting(E_ALL);
      //  ini_set('display_errors', 1);
        //debug end
        return $body;
    }  
     
     $icerik = GoogleBot('http://www.vericekileceksite.com/');

    arkadaşlar bu ve haricen denediğim bütün Curl fonksiyonları birbirine benziyor.
    bazıları kendini googlebot olarak tanıtıyor. Ama yinede bazı sitelerde ekrana boş sayfa basıyor.
    bu kodun proxy olmayanınıda çalışan proxy ile de deneyip te giremediğim siteler var.
    bir siteden veri çekerken curl neden çalışmadığını gösteren hataları ekrana bastırıp adım adım ilerlememi sağlayacak bir yöntem var mı.
  • 28-04-2017, 23:24:44
    #2
        $curl = curl_init();    
        curl_setopt($curl, CURLOPT_URL, $url);
       // curl_setopt($curl, CURLOPT_PORT, 7001);
        // curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
        curl_setopt ($curl,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
        curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
        curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
        curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0);
        $proxy ='89.55.55.55:80';
        curl_setopt($curl, CURLOPT_PROXY, $proxy);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_VERBOSE,true);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
    
       $body = curl_exec($curl);
    //// tam olarak hangi hata olduğunu anlamadım ama curl hatalarını 
    //// $err değişkenine bu şekilde atayabilirsiniz.    
    $err = curl_error($curl);
    //////////////////////////////////
        curl_close($curl);
        //debug
      //  error_re