My issue is in my title,also I will give java code and detail.
void getSourceCode(String text_url){
String source_code="";
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader((new URL(text_url)).openStream(), Charset.forName("UTF-8")));
String inputLine;
while ((inputLine = reader.readLine()) != null) {
source_code+=inputLine.replace(" ", "");
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (reader != null) {
try {
reader.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
System.out.println( source_code );
}
For example,I send "http://ekenlermangalkomuru.com/urunlerimiz/liste/144/BinarKömürü" as the parameter via html a href="..." parsing but the error report is :
java.io.IOException: Server returned HTTP response code: 400 for URL: http://ekenlermangalkomuru.com/urunlerimiz/liste/144/BinarKömürü
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source)
The link works on all browsers but when I tried to connect via java code it doesnt work.How I can I solve ? Thanks for all advices..