It sounds like you're looking for the URI class: http://ellislab.com/codeigniter/user-guide/libraries/uri.html
You can get the URL segments as an array by calling the segment_array()
method in your controller:
//get the URI segments
$segments = $this->uri->segment_array();