• 22-07-2010, 13:50:11
    #1
    Merhaba ; http://www.milliyetemlak.com/haber bu adrese aşağıdaki 2 kodu denememe rağmen, giriyorum ama. ilan arama ekranı geliyor karşıma. Browserda girdiğimiz gibi olmuyor...

    2 sinide denedim, hem fonksiyonu hem file_get i ama işe yaramadı...

    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;
    }
    $cek = cek("http://www.milliyetemlak.com/haber");
    $homepage = file_get_contents('http://www.milliyetemlak.com/haber');
  • 22-07-2010, 15:38:32
    #2
    Üyeliği durduruldu
    <?php
    	
    	$url = 'http://www.milliyetemlak.com/haber';
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL, $url);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_HEADER, false);
    	$return = curl_exec($ch);
    	curl_close($ch);
    	echo $return;
    	
    ?>
    Tarayıcıdaki gibi aynen geliyor karşıma :/ (Stil dosyası hariç)
  • 22-07-2010, 16:14:43
    #3
    Üyeliği durduruldu
    öncelikle useragent ı googlebot olarak tanımladığın için seni "m.milliyetemlak.com" gibi bir adrese yönlendiriyor. bu yüzden yalnızca arama kısmı çıkıyor.

    return $data; yerine echo $data; kullanmalısın.

    işine yaramayacaksa CURLOPT_HEADER değerini de false yapmalısın.