Ok, I am starting to understand what is going on now a little better.
I noticed that when I access
http://www.dreamteamfc.com/dtfc04/se...nguage=ENGLISH
The server sends a cookie. And then when I access
http://www.dreamteamfc.com/dtfc04/se...ERS&gameid=167
I get the table of players and their respective points.
I used the following code
public static void main (String[] args) throws IOException
{
URL url = new
URL("http://www.dreamteamfc.com/dtfc04/servlet/PostPlayerList?catidx=1&title=GOALKEEPERS&gameid=1 67");
URLConnection uc = url.openConnection();
System.out.println(uc.getHeaderField("Set-Cookie"));
}
To get the cookie, which was
CF_HA=2415676698; Domain=.dreamteamfc.com; expires=Tue, 14-Sep-04
22:25:46 GMT; Path=/
I think
CF_HA, is just a unique identifier, a variable which in incremented
by the server for each new client
Domain, is just the domain
expires, is just the expiry date
Path, hmm dunno
Now I hardcoded the cookie into the code, with a valid expiry date
public static void main (String[] args) throws IOException
{
URL url = new
URL("http://www.dreamteamfc.com/dtfc04/servlet/PostPlayerList?catidx=1&title=GOALKEEPERS&gameid=1 67");
URLConnection uc = url.openConnection();
String cookie = "CF_HA=2415676698; Domain=.dreamteamfc.com;
expires=Tue, 14-Sep-04 22:25:46 GMT; Path=/";
uc.setRequestProperty("cookie",cookie);
int i = 0;
while ((i = uc.getInputStream().read()) != -1)
{ System.out.print((char) i);
}
}
Now, when I run this code I get the following error
Exception in thread "main" java.io.IOException: Server returned HTTP
response code: 400 for URL:
http://www.dreamteamfc.com/dtfc04/se...ERS&gameid=167
at sun.net.
http://www.protocol.http.HttpURLConn...tion.java:1133)
at Test.main(Test.java:46)
Is the following method
uc.setRequestProperty("cookie",cookie);
The correct way to send the cookie to the server?
Any pointers on what I should try next, I'm not quite sure where to
look.
pat
Chander <sa***@ziksa.net> wrote in message news:<aK*********************@news20.bellglobal.co m>...
As I menatined earlier read the rfc for http 1.1 when you are requesting
a page firsdt you get is the header you get information for size of the
data to follow, if server has responded as error, what type of error..
or the page is to be redirected, etc.. as per these information you are
to read the following lines or resend the request to the other page as
direction in the header..
Cheers