curl - go to second page with query string
===

I need to use curl to login at a form and then get the second page. I have this:

    function http_post($url, $post, $url2, $post2) {
        $referer = "hp://www.jall.xxx.xxx/menu.do"; 
	    $ch = curl_init(); 
	    curl_setopt ($ch, CURLOPT_URL, $url); 
	    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
	    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0");
	    curl_setopt($ch,CURLOPT_COOKIESESSION,false); 
	    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
	    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);  
	    curl_setopt ($ch, CURLOPT_REFERER, $referer);
	    curl_setopt ($ch, CURLOPT_COOKIEJAR, 'my_cookies.txt');
	    curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); 
	    curl_setopt ($ch, CURLOPT_POST, 1); 
	
	    curl_exec($ch);
	
	    curl_setopt ($ch, CURLOPT_URL, $url2);
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	    curl_setopt($ch, CURLOPT_POST, 1); 
	
	    $test = curl_exec($ch);
	
	   curl_close($ch);

	return $test;
    }

    $data = array('l_username' => 'MY_LOGIN', 'l_password' => 'MY_PASSWORD');
    $data2 = array('seleciona' => '2', 'num' => '123456');

    echo http_post('http://www.jall.xxx.xxx/menu.do', http_build_query($data), 'http://www.jall.xxx.xxx/pesquisa_pesquisa.do', $data2);

If i use the second url like this ( hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do ) the return is ok, but i need to access this second page: hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do?seleciona=2&num=123456 with query string and when i use query string i get error.

1 - login: hxxp://www.jall.xxx.xxx/web/menu.do

2 - get source code: hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do?seleciona=2&num=123456