• 29-09-2013, 01:12:38
    #1
    Arkadaşlar bunun ile ilgili google da ne kadar kaynak varsa araştırdım ancak sorunuma hala çare bulamadım.

    wordpress temanın funcitons.php dosyasında şöyle bir kod var.

    function tweets() {
    		$json_string = $this->file_get_contents_curl( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $this->url );
    		$json = json_decode( $json_string, true );
    		return (isset( $json['count'] ) ? intval( $json['count'] ) : 0);
    	}
    
    	function fb() {
    		$json_string = $this->file_get_contents_curl( 'http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=' . $this->url );
    		$json = json_decode( $json_string, true );
    		return (isset( $json[0]['total_count'] ) ? intval( $json[0]['total_count'] ) : 0);
    	}
    
    	function plusones() {
    		$curl = curl_init(  );
    		curl_setopt( $curl, CURLOPT_URL, 'https://clients6.google.com/rpc' );
    		curl_setopt( $curl, CURLOPT_POST, true );
    		curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
    		curl_setopt( $curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . rawurldecode( $this->url ) . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]' );
    		curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
    		curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
    		$curl_results = curl_exec( $curl );
    		curl_close( $curl );
    		$json = json_decode( $curl_results, true );
    		return (isset( $json[0]['result']['metadata']['globalCounts']['count'] ) ? intval( $json[0]['result']['metadata']['globalCounts']['count'] ) : 0);
    	}
    
    	function pinterest() {
    		$json_string = $return_data = $this->file_get_contents_curl( 'http://api.pinterest.com/v1/urls/count.json?url=' . $this->url );
    		json_decode( $json_string, true );
    		$json = preg_replace( '/^receiveCount\((.*)\)$/', '\1', $return_data );
    		return (isset( $json['count'] ) ? intval( $json['count'] ) : 0);
    	}
    
    	function file_get_contents_curl($url) {
    		$ch = curl_init(  );
    		curl_setopt( $ch, CURLOPT_URL, $url );
    		curl_setopt( $ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] );
    		curl_setopt( $ch, CURLOPT_FAILONERROR, 1 );
    		curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
    		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    		curl_setopt( $ch, CURLOPT_TIMEOUT, $this->timeout );
    		$cont = curl_exec( $ch );
    
    		if (curl_error( $ch )) {
    			exit( curl_error( $ch ) );
    		}
    
    		return $cont;
    	}
    }

    Sitede aldığım hata ise bu şekilde

    Alıntı
    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in
    Ne yapmam gerekir? Nerede sorun var?

    EDİT: Sorunu hallettim. Ama bu seferde ne gelen ne de giden bir veri var :S

    --R10.NET; Flood Engellendi -->-> Yeni yazılan 29-09-2013 mesaj 01:12:38 -->-> Daha önceki 28-09-2013 mesaj 23:48:26 --

    Yok mu ilgilenicek kimse?
  • 29-09-2013, 01:20:25
    #2
    CURLOPT_FOLLOWLOCATION, safe_mod veya open_basedir açık ise çalışmaz. Hata almanızın sebebi bu.

    bu satırdaki

    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );

    1 yazan yeri 0 yaparsanız hata kalkacaktır fakat bu sefer fonksiyonun yaptığı işlem gerçekleşmeyebilir.
  • 29-09-2013, 01:40:56
    #3
    Hayko adlı üyeden alıntı: mesajı görüntüle
    CURLOPT_FOLLOWLOCATION, safe_mod veya open_basedir açık ise çalışmaz. Hata almanızın sebebi bu.

    bu satırdaki

    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );

    1 yazan yeri 0 yaparsanız hata kalkacaktır fakat bu sefer fonksiyonun yaptığı işlem gerçekleşmeyebilir.
    verileri çekmemesinde ki neden yine safe mod un açık olmasından kaynaklanan bir durum mu peki?
  • 29-09-2013, 01:47:49
    #4
    OttomanGuardian adlı üyeden alıntı: mesajı görüntüle
    verileri çekmemesinde ki neden yine safe mod un açık olmasından kaynaklanan bir durum mu peki?
    evet.
  • 29-09-2013, 01:49:21
    #5
    Ulan var ya saatlerdir kafayı yedirtti bana. Denemediğim yöntem kalmadı.
  • 29-09-2013, 15:17:27
    #6
    http://stackoverflow.com/questions/1...led-or-an-open

    bu konudaki verilen cevap da anlatılmış. Biraz karışık gelebilir ama kesin çözüm burada.
  • 29-09-2013, 15:21:52
    #7
    Bir çözüm öneresini sunabilirim, header bilgisini alıp location yaptığı yeri explode ile kesip tekrarında aynı çerez bilgileri ile yeni locationa yönlendirseniz followlocationun görevini siz tamamlamış olursunuz.