İşinizi görecektir.

    public function get_data( $url, $query = "" ) {  
        if ( function_exists('curl_exec') ) {  
            $ch = curl_init();  
            $timeout = 10;  
            if (!empty( $query ) ) {  
                curl_setopt($ch, CURLOPT_URL, $url);  
                curl_setopt($ch, CURLOPT_POST, true);  
                curl_setopt($ch, CURLOPT_POSTFIELDS, $query);  
                curl_setopt($ch, CURLOPT_REFERER, $this->ref_link);  
                curl_setopt($ch, CURLOPT_HEADER, 1);  
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
                $data = curl_exec($ch);  
                curl_close($ch);  
                return $data;  
            } else {  
                curl_setopt($ch, CURLOPT_URL, $url);  
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);  
                $data = curl_exec($ch);  
                curl_close($ch);  
                return $data;  
            }  
        } else {  
            $data = file_get_contents($url);  
            return $data;  
        }  
    }