CodeIgniter get site url

How to get site url of the codeigniter.You can use this method in the controller,model and view files.
First, you have to call this URL Helper file.

$this->load->helper('url');

// this is get from config file.
base_url();
or
// this is also get from config file.
site_url();
or
// core php server variables
$_SERVER{'DOCUMENT_ROOT'}

Also you can use following script to get site url in view files.

 echo site_url('buyer/editProfile/50');
// output like this.
//http://www.mysite.com/buyer/editProfile/50