I'm having problems accessing a particular web page. If I try e.g. Humber Squash - humbersquash.org - Results it works fine, but with Humber Squash - humbersquash.org - The Clubs I get a java.io.FileNotFoundException. Is there any reason why a .html should need processing differently to a .asp? This is the code:
public static String getData(String url, String post) {
String pageContent="";
try
{
URL myUrl = new URL(url);
HttpURLConnection myConnection = null;
myConnection = (HttpURLConnection)myUrl.openConnection();
myConnection.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(myConnection.getOutputStream());
if (post != "") {
wr.write(post);
wr.flush();
};
InputStream in = myConnection.getInputStream();
StringBuffer myStringBuffer = new StringBuffer();
int b;
while ((b = in.read()) != -1)
{
myStringBuffer.append((char)b);
}
pageContent=myStringBuffer.toString();
wr.close();
in.close();
}
catch(Throwable e)
{
System.out.println("*****Web error " + e);
}
return pageContent;
}
public static String getData(String url, String post) {
String pageContent="";
try
{
URL myUrl = new URL(url);
HttpURLConnection myConnection = null;
myConnection = (HttpURLConnection)myUrl.openConnection();
myConnection.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(myConnection.getOutputStream());
if (post != "") {
wr.write(post);
wr.flush();
};
InputStream in = myConnection.getInputStream();
StringBuffer myStringBuffer = new StringBuffer();
int b;
while ((b = in.read()) != -1)
{
myStringBuffer.append((char)b);
}
pageContent=myStringBuffer.toString();
wr.close();
in.close();
}
catch(Throwable e)
{
System.out.println("*****Web error " + e);
}
return pageContent;
}