• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem accessing web page

shadowy

Newbie
Sep 30, 2010
25
2
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;
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones