Nie wglebiajac sie glebiej w tematyke, probuje sie zalogowac program na forum darkwarez - problem w tym ze nie dostaje cookiesow, moze ktos znajdzie blad :)

try
{
String cookiee=null;
data = URLEncoder.encode("usrname", "UTF-8") + "=" + URLEncoder.encode("login", "UTF-8");
data += "&" + URLEncoder.encode("passwrd", "UTF-8") + "=" + URLEncoder.encode("pass", "UTF-8");
data += "&" + URLEncoder.encode("redirect", "UTF-8") + "=" + URLEncoder.encode("", "UTF-8");
data += "&" + URLEncoder.encode("login", "UTF-8") + "=" + URLEncoder.encode("Zaloguj", "UTF-8");
System.out.println(data);
URL url = new URL("http://darkwarez.pl/forum/login.php");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setAllowUserInteraction(true);
conn.setInstanceFollowRedirects(true);
HttpURLConnection.setFollowRedirects(true);
conn.setRequestProperty("User-Agent","User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0");
conn.setRequestProperty("Set-Cookie", cookiee);
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();

        String headerName="";
        for (int i=1; (headerName = conn.getHeaderFieldKey(i))!=null; i++) 
        {
            System.out.println(conn.getHeaderField(i));
            if (headerName.equals("Set-Cookie"))                   
                cookiee += conn.getHeaderField(i)+"; ";
        }
        System.out.println(cookiee);
        wr.close();

    }
    catch(Exception e)
    {
        System.out.println("e"+e);
    }


//edit
dodam jeszcze komunikacje z firefoxa wzieta
[code]http://darkwarez.pl/forum/login.php

POST /forum/login.php HTTP/1.1
Host: darkwarez.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Referer: http://darkwarez.pl/forum/
Content-Type: application/x-www-form-urlencoded
Content-Length: 47
usrname=login&passwrd=pass&login=Zaloguj
HTTP/1.0 302 Moved Temporarily
Set-Cookie: ....tu cookies
Set-Cookie: ....tu cookies
Location: http://darkwarez.pl/forum/index.php
Content-Type: text/html
Content-Length: 0
Date: Sun, 04 Dec 2011 03:27:29 GMT
Connection: keep-alive