M
mfasoccer
Im working on a project that involves searching with google. I have
been getting an http 403 error with the following code:
import java.net.*;
import java.io.*;
public class GoogleSearchTest
{
public static void main(String[] args) throws Exception{
URL hp = new URL("http://www.google.com/search?q=babelfish");
URLConnection hpCon = hp.openConnection();
hpCon.connect();
InputStream input = hpCon.getInputStream(); // error traces to here
/*
This code is all irrelevant to my problem because
the inputstream is refuted
String content = "";
int c;
while((c = input.read()) != -1)
content += (char)c;
*/
}
}
I know that http 403 error means that the server understood the
request, yet refused it. As you can probably tell I have very little
network programming experience, so maybe more experienced programmers
could help alter my approach, or explain a better one? Thanks.
been getting an http 403 error with the following code:
import java.net.*;
import java.io.*;
public class GoogleSearchTest
{
public static void main(String[] args) throws Exception{
URL hp = new URL("http://www.google.com/search?q=babelfish");
URLConnection hpCon = hp.openConnection();
hpCon.connect();
InputStream input = hpCon.getInputStream(); // error traces to here
/*
This code is all irrelevant to my problem because
the inputstream is refuted
String content = "";
int c;
while((c = input.read()) != -1)
content += (char)c;
*/
}
}
I know that http 403 error means that the server understood the
request, yet refused it. As you can probably tell I have very little
network programming experience, so maybe more experienced programmers
could help alter my approach, or explain a better one? Thanks.