private void generatePages(String City, String Branche, String rootfolder) throws SAXException, MalformedURLException, IOException{ System.out.println("Started..."); boolean isRunning = true; //THE FIRST PAGE String source; WebConversation wc = new WebConversation(); System.out.println("Going to main-search-page..."); HttpUnitOptions.setScriptingEnabled( false ); WebResponse resp = wc.getResponse("http://wappc.pagesjaunes.fr/pj.cgi"); //We go to the form. System.out.println("Doing form-request..."); WebForm form = resp.getForms()[0]; // select the first form in the page System.out.println("Form-Name: "+form.getName()); form.setParameter( "FRM_ACTIVITE", Branche ); // Insert values... form.setParameter( "FRM_LOCALITE", City ); // Insert values... System.out.println("Submitting..."); resp = form.submit(); //We submit the filled form. System.out.println("Done Submit..."); source = readout(resp.getInputStream()); //We fetch the source-code of the page. System.out.println("Got the first page:"+source); //Source der ersten Seite in eine File: writeCode(source, new File(rootfolder+System.currentTimeMillis())); //We write the source into a file* ///// //Alle anderen Seiten. boolean passed = false; System.out.println("Get the following pages...."); while(isRunning == true){ System.out.println("Running..."); HttpUnitOptions.setScriptingEnabled( true ); WebLink link = resp.getLinkWithImageText("Page suivante"); //We go to the picture with the alt-tag "suivante" if(link == null){ System.out.println("No new \"Next\"-Link found..."); isRunning = false; break; } else { resp = wc.getCurrentPage(); // We get the result. source = readout(resp.getInputStream()); //We fetch the source. System.out.println("Source of page-follower extracted: "+source); //Source der ersten Seite in den Array: writeCode(source, new File(rootfolder+System.currentTimeMillis()+".html")); //We write the source into a file. } } //END of WHILE. } //END of FUNCTION