|
-
Mar 30th, 2010, 02:43 AM
#1
Thread Starter
Lively Member
Connect to another website using Java Applet
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.
-
Mar 30th, 2010, 06:16 AM
#2
Re: Connect to another website using Java Applet
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Apr 3rd, 2010, 01:06 AM
#3
Thread Starter
Lively Member
Re: Connect to another website using Java Applet
Thanks for your reply..
I have tried this and it's giving me errors while compiling.
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);
}
All i want is just a very simple and basic applet to connect to a website and grab the text response.
Thanks in advance.
-
Apr 3rd, 2010, 12:56 PM
#4
Re: Connect to another website using Java Applet
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.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|