Find URL paramenters from a string

I have a string which contain some parameters I want to extract but I cant get it to look good. Here is what I have right now

puts Rack::Utils.parse_query("http://www.aspnetpage.com/frmindex?id=5&shelf=111"\) {"http://www.aspnetpage.com/frmindex?id"=>"5", "shelf"=>"111"}

As you can see my main problem is that the first parameter name ... how what is the right method for this??

Pass it only the string after the ?