Hello all,
Would someone please tell me how can i connect to a website using Java Applet and read the output stream from that site.
Thanks in advance.
Printable View
Hello all,
Would someone please tell me how can i connect to a website using Java Applet and read the output stream from that site.
Thanks in advance.
You can read the Java Socket tutorial
Thanks for your reply..
I have tried this and it's giving me errors while compiling.
All i want is just a very simple and basic applet to connect to a website and grab the text response.Code:import java.awt.*;
import java.applet.*;
import java.io.*;
import java.net.*;
public class testapplet extends Applet
{
URL myURL = new URL("http://www.google.com");
URLConnection conn = myURL.openConnection();
conn.setDoOutput(true);
conn.setDoInput(false);
InputStream is = conn.getInputStream();
System.out.println(is);
}
Thanks in advance.
If you knew anything about programming, you'd know you can't place your method calls from the class body.
You'll have to override the start method.