How to get the url of the SuiteCRM application index.php

Hi!
I would like to know , How to get the URL of the SUITECRM application.
Ex : http://localhost:8088/mySuite/index.php or http://www.test.com/index.php

I am going to built a URL for a record. So i need to have the application URL to build the URL for the record.
Ex: http://localhost:8088/suiteCRM78/index.php?module=CustomModulet&action=DetailView&record=" . $record_id

Is there any other way to get the Site URL of the SuiteCRM application?. If you can share any other ways to do this, that will be helpful.

Thanks

I tried these but could not get what I neeed
http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php


global $sugar_config;
$siteUrl = $sugar_config['site_url'];

Thank You, It worked as I expected