First of all; sorry for the bad title, I don't know what to call it
My problem is this: I have a javabean which is used to read pages
from websites and I want this bean to tell the host what the "browser name" is. My current code doesn't set any such value on the host other than null.
/*****************************************************************/
public
String readPage(String strHost, int intPort, String strFile)
{
String strContent = "";
//Read content from page
try
{
Socket socket = new Socket(strHost, intPort);
BufferedReader inputStream = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
PrintWriter outputStream = new PrintWriter(
new OutputStreamWriter(socket.getOutputStream()),true);
outputStream.println("GET /" + strFile);
// I guess this is where the action must happen?
String strLine = "";
while((strLine = inputStream.readLine()) != null)
{
strContent += strLine + "\n";
}
socket.close();
}
catch(IOException ioe)
{
Debug.print("IOException", this);
}
return strContent;
}
/******************************************************************/
Any help much appreciated.