$url = "http://sitename/search?categories=26&brands=6338,112&price_min=556&price _max=42785&discount=0"
нужно ее преобразовать в вид
$url = "http://sitename/search?categories=26&brands=6338&brands=112&price_min=55 6&price_max=42785&discount=0"
остановился на следующем
$a = "http://sitename/search?categories=26&brands=6338,112&price_min=556&price _max=42785&discount=0";
preg_match("/\/search\/?\?.*categories=([\d]+)(.*)$/", $a, $m);
$c = split("&", $m[2]);
foreach ($c as $k => $v){
$params = explode("=", $v);
}