URL_REWRITE以“?”传递参数

I'm doing a job for a person who has a website that use the URL rewrite mod, and the parameters are passed like this: www.site.com/val1/val2/val3 and i get them with a getPararm(n) function.

I had to implement a credit card payment system, and this service, once the payment is done, Send me back the answer to a page that I choose, in this way: www.yourSite.com?a=val1&b=val2

Ofc I choosed a page of that website, so i get an answer like this: www.site.com/confirmed/?a=val1&b=val2

With some string manipulation i would be able to get all the string after the final "/", and separate them in 2 separate string $a=val and $b=val2, but because of the "?" it doesnt read anything after it. How can I solve this problem?

@deceze thnk i didn't know that if i would use $_GET['a'] for example it was going to read the part after, thnk you! I was using $_GET['a'] withouth the "?" so it wasnt going to see it, or getParam(0) with the "?" so i couldnt get anything. I didn't try this way