I am trying to check thousands of URLs from search engine index, If they are existing or not. I need a Java program which can trigger these url one at a time to the search engine and record the response If it exists or not. I already ask this question to some Java questions and answers forum. But still I am waiting for complete solution. Someone there who would be willing to spend some time to support me to solve this problem.
Hey, try using this code : Code: import java.io.IOException; import java.net.*; import java.util.*; public class URLAccess { public List<String> urls; public static void main(String[] args) { URLAccess ua = new URLAccess(); ua.run(); } public URLAccess() { this.urls = new ArrayList<String>(); // Read them from external XML or some other sources instead! this.urls.add("http://google.com"); this.urls.add("http://alksdfjlaksjdflkajsdf.com"); } public void run() { this.urls.forEach(this::accessUrl); } public void accessUrl(String urlString) { try { URL url = new URL(urlString); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); System.out.println("Success"); } catch (IOException ignored) { System.out.println("Failed"); } } } Or if you need any help you can check " http://www.keenesystems.com/Services/SoftwareDevelopment.aspx " Regards Alia