Forum Moderators: phranque
I need some hint for a small programming project?
I want to write a PHP or JSP script which will run a query which is much like ...
[google.com...]
I will be feeding a variety of things to it (e.g "nehal" in this case)to the script from time to time. But, I do not know how to get the response and SAVE it as a separate HTML Document everytime with a new name and with all the images and stuff in it.
Please help, it could lead me to a full-time job.
It sounds much like a spider, but my spider will spider only my site. limited...
Thanks.
-nehal
But then, how would I save the response of that Query generated by the URL I produce?
IS it like this?
1. I pass the URL to a class which will in turn open a connection to the net using the URL and that's how I will go to that page.
2. After I am on that page, my class' method can save the Response as a file.
Am I on a right direction?
Please help.
I was online when I run the code ...didn't get anything in the file...
:(
import java.net.*;
import java.io.*;
public class Url {
public static void main(String[] argv){
BufferedInputStream text= null;
URLConnection conn = null;
PrintWriter fout = null;
try{
URL url = new URL("http://WWW.YAHOO.COM/");
try{
text = new BufferedInputStream(url.openStream());
fout= new PrintWriter(new FileWriter("SS1.html"));
fout.println( "------------------------" );
fout.println(text);
fout.println( "------------------------" );
fout.close();
}
catch(Exception e)
{}
System.out.println(text);
}
}
}