• 31-07-2010, 05:45:36
    #1
    Merhaba arkadaşlar, Bir siteye giriyorum. Site cache kontrl yapıyor. Eğer yok ise cache izin vermiyor. kullandığım kodlar aşağıdaki gibi

    function cek($url)
    {        $ch = curl_init();
            $timeout = 5;
             
            curl_setopt($ch,CURLOPT_URL,$url);
            curl_setopt($ch,CURLOPT_HEADER,true);
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
            curl_setopt($ch,CURLOPT_REFERER,"http://www.google.com");
            curl_setopt($ch,CURLOPT_USERAGENT,"googlebot");
            $data = curl_exec($ch);
            
            curl_close($ch);
            return $data;
    }
    Cache kaydetmesi için neler eklemem lazım ?
  • 31-07-2010, 09:06:59
    #2
    bunu bir deneyiniz
    function cek($url)
    {        $ch = curl_init();
            $timeout = 5;
            $cookie_session_id = "WT_FPC=id=2acba6cdf3fab647b521204106034801:lv=1204106303613:ss=1204106034801";
            $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
            $header[0] .= "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: tr-TR,tr;q=0.8";
            $header[] = "Cookie: $cookie_session_id";
            $header[] = "Pragma: ";
            curl_setopt($ch,CURLOPT_URL,$url);
            curl_setopt($ch,CURLOPT_HEADER,true);
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
            curl_setopt($ch,CURLOPT_HTTPHEADER, $header); 
            curl_setopt($ch,CURLOPT_REFERER,"http://www.google.com");
            curl_setopt($ch,CURLOPT_USERAGENT,"googlebot");
            $data = curl_exec($ch);
            
            curl_close($ch);
            return $data;
    }