Non ti fare fermare da questo cose
vuole solo un User-Agent (di qualsiasi sorta), per esempio in questo modo li freghiamo
codice:
import java.net.*;
import java.io.*;
/**
*
* @author Andrea
*/
public class URLReader {
private URL url;
private BufferedReader br;
private StringBuffer sbuf;
public String toString() {
return sbuf.toString();
}
/** Creates a new instance of URLReader */
public URLReader(String url) throws Exception {
this.url = new URL(url);
this.sbuf = new StringBuffer();
HttpURLConnection httpURLConnection = (HttpURLConnection)this.url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setUseCaches(false);
httpURLConnection.setRequestProperty("Referer", "http://www.borsaitalian.it");
httpURLConnection.setRequestProperty("User-Agent", "Internet Explorer");
this.br = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
String line = "";
while ((line = this.br.readLine()) != null) {
sbuf.append(line+"\n");
}
}
public static void main (String[] args) {
try {
URLReader ur = new URLReader("http://www.borsaitaliana.it/bitApp/quotes.bit?target=SearchQuotes&grp=iniziale¶m=A");
System.out.println(ur);
}
catch (Exception e) {
e.printStackTrace();
}
}
}